]> git.baikalelectronics.ru Git - kernel.git/commit
KEYS: fix key refcount leak in keyctl_read_key()
authorEric Biggers <ebiggers@google.com>
Mon, 18 Sep 2017 18:36:31 +0000 (11:36 -0700)
committerDavid Howells <dhowells@redhat.com>
Mon, 25 Sep 2017 14:19:57 +0000 (15:19 +0100)
commit606eaa7ee0beccbacef068872ecef45642d7f2ef
tree0b652a2ec8836a6d101e48a0ba1e07472f636432
parenta78c9b211d97a01ae900853a584cbf5db71309fd
KEYS: fix key refcount leak in keyctl_read_key()

In keyctl_read_key(), if key_permission() were to return an error code
other than EACCES, we would leak a the reference to the key.  This can't
actually happen currently because key_permission() can only return an
error code other than EACCES if security_key_permission() does, only
SELinux and Smack implement that hook, and neither can return an error
code other than EACCES.  But it should still be fixed, as it is a bug
waiting to happen.

Fixes: 1f9c4cc96b39 ("[PATCH] Keys: Add LSM hooks for key management [try #3]")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
security/keys/keyctl.c