* [PATCH] keys: crypto: Replace BUG_ON() with WARN() in find_asymmetric_key()
@ 2021-01-15 7:21 jarkko
0 siblings, 0 replies; only message in thread
From: jarkko @ 2021-01-15 7:21 UTC (permalink / raw)
To: dhowells
Cc: andrew.zaborowski, joeyli.kernel, Jarkko Sakkinen, stable,
Herbert Xu, David S. Miller
From: Jarkko Sakkinen <jarkko@kernel.org>
BUG_ON() should not be used in the kernel code, unless there are
exceptional reasons to do so. Replace BUG_ON() with WARN() and
return.
Cc: stable@vger.kernel.org
Fixes: b3811d36a3e7 ("KEYS: checking the input id parameters before finding asymmetric key")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
crypto/asymmetric_keys/asymmetric_type.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/crypto/asymmetric_keys/asymmetric_type.c b/crypto/asymmetric_keys/asymmetric_type.c
index 33e77d846caa..47cc88fa0fa7 100644
--- a/crypto/asymmetric_keys/asymmetric_type.c
+++ b/crypto/asymmetric_keys/asymmetric_type.c
@@ -54,7 +54,10 @@ struct key *find_asymmetric_key(struct key *keyring,
char *req, *p;
int len;
- BUG_ON(!id_0 && !id_1);
+ if (!id_0 && !id_1) {
+ WARN(1, "All ID's are NULL\n");
+ return ERR_PTR(-EINVAL);
+ }
if (id_0) {
lookup = id_0->data;
--
2.29.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-15 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-15 7:21 [PATCH] keys: crypto: Replace BUG_ON() with WARN() in find_asymmetric_key() jarkko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox