aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-11-01 00:15:30 -0400
committerDavid S. Miller <davem@davemloft.net>2015-11-01 00:15:30 -0400
commitb75ec3af27bf011a760e2f44eb25a99b6fbb0fb3 (patch)
tree89f4fbab2c6194b32a46eb771c4b158585bf0bb5 /security
parente7b63ff115f21ea6c609cbb08f3d489af627af6e (diff)
parent523e13455ec9ec4457a5a1d24ff7132949742b70 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'security')
-rw-r--r--security/keys/gc.c6
-rw-r--r--security/keys/request_key.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 39eac1fd5706..addf060399e0 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -134,8 +134,10 @@ static noinline void key_gc_unused_keys(struct list_head *keys)
134 kdebug("- %u", key->serial); 134 kdebug("- %u", key->serial);
135 key_check(key); 135 key_check(key);
136 136
137 /* Throw away the key data */ 137 /* Throw away the key data if the key is instantiated */
138 if (key->type->destroy) 138 if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) &&
139 !test_bit(KEY_FLAG_NEGATIVE, &key->flags) &&
140 key->type->destroy)
139 key->type->destroy(key); 141 key->type->destroy(key);
140 142
141 security_key_free(key); 143 security_key_free(key);
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 486ef6fa393b..0d6253124278 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -440,6 +440,9 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx,
440 440
441 kenter(""); 441 kenter("");
442 442
443 if (ctx->index_key.type == &key_type_keyring)
444 return ERR_PTR(-EPERM);
445
443 user = key_user_lookup(current_fsuid()); 446 user = key_user_lookup(current_fsuid());
444 if (!user) 447 if (!user)
445 return ERR_PTR(-ENOMEM); 448 return ERR_PTR(-ENOMEM);