KEYS: checking the input id parameters before finding asymmetric key
authorChun-Yi Lee <joeyli.kernel@gmail.com>
Wed, 4 Oct 2017 08:45:09 +0000 (16:45 +0800)
committerDavid Howells <dhowells@redhat.com>
Wed, 18 Oct 2017 08:12:40 +0000 (09:12 +0100)
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>
crypto/asymmetric_keys/asymmetric_type.c

index a597f5c5a2228050b7831daf7e7ffbf5374ce634..39aecad286fe482ff3f44fe08b286c2edbf3553b 100644 (file)
@@ -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;