Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734379

[PATCH] KEYS: fix cred refcount leak in request_key_auth_new()

From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] KEYS: fix cred refcount leak in request_key_auth_new()
Date 2017-09-18 20:40 +0200
Message-ID <ur97A-1vB-27@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Eric Biggers <ebiggers@google.com>

In request_key_auth_new(), if alloc_key() or key_instantiate_and_link()
were to fail, we would leak a reference to the 'struct cred'.  Currently
this can only happen if alloc_key() fails to to allocate memory.  But it
still should be fixed, as it is a more severe bug waiting to happen.

Fixes: d84f4f992cbd ("CRED: Inaugurate COW credentials")
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 security/keys/request_key_auth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index afe9d22ab361..f2f29f13ecff 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -227,6 +227,7 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info,
 	key_revoke(authkey);
 	key_put(authkey);
 error_alloc:
+	put_cred(rka->cred);
 	key_put(rka->target_key);
 	key_put(rka->dest_keyring);
 	kfree(rka->callout_info);
-- 
2.14.1.690.gbb1197296e-goog

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] KEYS: fix cred refcount leak in request_key_auth_new() Eric Biggers <ebiggers3@gmail.com> - 2017-09-18 20:40 +0200
  Re: [PATCH] KEYS: fix cred refcount leak in request_key_auth_new() David Howells <dhowells@redhat.com> - 2017-09-19 17:50 +0200
    Re: [PATCH] KEYS: fix cred refcount leak in request_key_auth_new() Eric Biggers <ebiggers3@gmail.com> - 2017-09-21 22:40 +0200

csiph-web