KEYS: don't revoke uninstantiated key in request_key_auth_new()
authorEric Biggers <ebiggers@google.com>
Thu, 21 Sep 2017 20:57:41 +0000 (13:57 -0700)
committerDavid Howells <dhowells@redhat.com>
Mon, 25 Sep 2017 14:19:56 +0000 (15:19 +0100)
commitf7b48cf08fa63a68b59c2894806ee478216d7f91
tree49f1c5c64627568698ea5313c40ad193d84db664
parent44d8143340a99b167c74365e844516b73523c087
KEYS: don't revoke uninstantiated key in request_key_auth_new()

If key_instantiate_and_link() were to fail (which fortunately isn't
possible currently), the call to key_revoke(authkey) would crash with a
NULL pointer dereference in request_key_auth_revoke() because the key
has not yet been instantiated.

Fix this by removing the call to key_revoke().  key_put() is sufficient,
as it's not possible for an uninstantiated authkey to have been used for
anything yet.

Fixes: b5f545c880a2 ("[PATCH] keys: Permit running process to instantiate keys")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
security/keys/request_key_auth.c