keys: Fix missing null pointer check in request_key_auth_describe()
[sfrench/cifs-2.6.git] / security / keys / request_key_auth.c
index e73ec040e2509494d3d123ad8c47419b747a33f7..ecba39c93fd91f887026c3f9c8f6bc3270fc9225 100644 (file)
@@ -66,6 +66,9 @@ static void request_key_auth_describe(const struct key *key,
 {
        struct request_key_auth *rka = dereference_key_rcu(key);
 
+       if (!rka)
+               return;
+
        seq_puts(m, "key:");
        seq_puts(m, key->description);
        if (key_is_positive(key))
@@ -83,6 +86,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;