diff options
author | Eric Biggers <ebiggers@google.com> | 2017-09-18 21:36:12 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2017-09-25 17:19:57 +0300 |
commit | 884bee0215fcc239b30c062c37ca29077005e064 (patch) | |
tree | e74b9a72d9bdffcc459d8a0393a6f908ef4d213a /security/Kconfig | |
parent | f7b48cf08fa63a68b59c2894806ee478216d7f91 (diff) | |
download | linux-884bee0215fcc239b30c062c37ca29077005e064.tar.xz |
KEYS: fix key refcount leak in keyctl_assume_authority()
In keyctl_assume_authority(), if keyctl_change_reqkey_auth() were to
fail, we would leak the reference to the 'authkey'. Currently this can
only happen if prepare_creds() fails to allocate memory. But it still
should be fixed, as it is a more severe bug waiting to happen.
This patch also moves the read of 'authkey->serial' to before the
reference to the authkey is dropped. Doing the read after dropping the
reference is very fragile because it assumes we still hold another
reference to the key. (Which we do, in current->cred->request_key_auth,
but there's no reason not to write it in the "obviously correct" way.)
Fixes: d84f4f992cbd ("CRED: Inaugurate COW credentials")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/Kconfig')
0 files changed, 0 insertions, 0 deletions