aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/key.c
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2016-01-07 07:46:36 -0500
committerMimi Zohar <zohar@linux.vnet.ibm.com>2016-01-07 12:56:42 -0500
commit1d6d167c2efcfe9539d9cffb1a1be9c92e39c2c0 (patch)
treef875b8a19d539701b31ea4ffce40eee77c701103 /security/keys/key.c
parent6427e6c71c8b374761b661c4f355762794c171a1 (diff)
KEYS: refcount bug fix
This patch fixes the key_ref leak, removes the unnecessary KEY_FLAG_KEEP test before setting the flag, and cleans up the if/then brackets style introduced in commit: d3600bc KEYS: prevent keys from being removed from specified keyrings Reported-by: David Howells <dhowells@redhat.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Acked-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 09ef276c4bdc..07a87311055c 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -430,8 +430,7 @@ static int __key_instantiate_and_link(struct key *key,
430 430
431 /* and link it into the destination keyring */ 431 /* and link it into the destination keyring */
432 if (keyring) { 432 if (keyring) {
433 if (test_bit(KEY_FLAG_KEEP, &keyring->flags)) 433 set_bit(KEY_FLAG_KEEP, &key->flags);
434 set_bit(KEY_FLAG_KEEP, &key->flags);
435 434
436 __key_link(key, _edit); 435 __key_link(key, _edit);
437 } 436 }