]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - security/keys/request_key_auth.c
keys: Fix missing null pointer check in request_key_auth_describe()
[mirror_ubuntu-bionic-kernel.git] / security / keys / request_key_auth.c
index 5e515791ccd119d89150f6ede3f0a2a91eccbf9f..1d34b2a5f485e2380e8b092cfb62955434c3f908 100644 (file)
@@ -71,6 +71,9 @@ static void request_key_auth_describe(const struct key *key,
 {
        struct request_key_auth *rka = get_request_key_auth(key);
 
+       if (!rka)
+               return;
+
        seq_puts(m, "key:");
        seq_puts(m, key->description);
        if (key_is_positive(key))
@@ -88,6 +91,9 @@ static long request_key_auth_read(const struct key *key,
        size_t datalen;
        long ret;
 
+       if (!rka)
+               return -EKEYREVOKED;
+
        datalen = rka->callout_len;
        ret = datalen;