summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChun-Yi Lee <joeyli.kernel@gmail.com>2017-10-04 16:45:09 +0800
committerDavid Howells <dhowells@redhat.com>2017-10-18 09:12:40 +0100
commitb3811d36a3e7e7e8ed660bf01151496cf99cf9ed (patch)
tree5768d72b30b94cccbe53e01a4b608f7f9b3836b1
parent6a6d2a77addce6bc26ccb53df34478b1593f0fbf (diff)
downloadlinux-b3811d36a3e7e7e8ed660bf01151496cf99cf9ed.tar.bz2
KEYS: checking the input id parameters before finding asymmetric key
For finding asymmetric key, the input id_0 and id_1 parameters can not be NULL at the same time. This patch adds the BUG_ON checking for id_0 and id_1. Cc: David Howells <dhowells@redhat.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Chun-Yi Lee <jlee@suse.com> Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--crypto/asymmetric_keys/asymmetric_type.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/asymmetric_keys/asymmetric_type.c b/crypto/asymmetric_keys/asymmetric_type.c
index a597f5c5a222..39aecad286fe 100644
--- a/crypto/asymmetric_keys/asymmetric_type.c
+++ b/crypto/asymmetric_keys/asymmetric_type.c
@@ -57,6 +57,8 @@ struct key *find_asymmetric_key(struct key *keyring,
char *req, *p;
int len;
+ BUG_ON(!id_0 && !id_1);
+
if (id_0) {
lookup = id_0->data;
len = id_0->len;