Thread (9 messages) 9 messages, 2 authors, 2020-10-06

[PATCH net 2/6] rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read()

flat view
STALE2200d SUPERSEDED

From: David Howells <dhowells@redhat.com>
Date: 2020-10-05 16:19:10
Also in: lkml
Subsystem: networking [general], rxrpc sockets (af_rxrpc), the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Howells, Marc Dionne, Linus Torvalds

Revision v1 of 30 in this series.

Revisions (30)
  1. v1
  2. v1
  3. v1 current
  4. v1
  5. v1
  6. v3 [diff vs current]
  7. v1
  8. v1
  9. v1
  10. v1
  11. v1
  12. v2 [diff vs current]
  13. v1
  14. v2 [diff vs current]
  15. v1
  16. v2 [diff vs current]
  17. v3 [diff vs current]
  18. v4 [diff vs current]
  19. v5 [diff vs current]
  20. v1
  21. v2 [diff vs current]
  22. v1
  23. v1
  24. v1
  25. v2 [diff vs current]
  26. v3 [diff vs current]
  27. v9 [diff vs current]
  28. v10 [diff vs current]
  29. v11 [diff vs current]
  30. v12 [diff vs current]
If rxrpc_read() (which allows KEYCTL_READ to read a key), sees a token of a
type it doesn't recognise, it can BUG in a couple of places, which is
unnecessary as it can easily get back to userspace.

Fix this to print an error message instead.

Fixes: 99455153d067 ("RxRPC: Parse security index 5 keys (Kerberos 5)")
Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/rxrpc/key.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
index 8f7d7a6187db..c668e4b7dbff 100644
--- a/net/rxrpc/key.c
+++ b/net/rxrpc/key.c
@@ -1107,7 +1107,8 @@ static long rxrpc_read(const struct key *key,
 			break;
 
 		default: /* we have a ticket we can't encode */
-			BUG();
+			pr_err("Unsupported key token type (%u)\n",
+			       token->security_index);
 			continue;
 		}
 
@@ -1223,7 +1224,6 @@ static long rxrpc_read(const struct key *key,
 			break;
 
 		default:
-			BUG();
 			break;
 		}
 

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help