diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-26 06:39:46 +0900 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-26 06:39:46 +0900 |
| commit | 0bbc367e21bfeea33230d893be4fa3a3ff9bcb48 (patch) | |
| tree | 50fb335648a22ac519eddb772714ba64a3e6a7ec /security/keys | |
| parent | ae416ba4e94a30486ba2af0afe052579e7114ab8 (diff) | |
| parent | 32b88194f71d6ae7768a29f87fbba454728273ee (diff) | |
Merge 4.3-rc7 into usb-next
We want the USB and other fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security/keys')
| -rw-r--r-- | security/keys/gc.c | 6 | ||||
| -rw-r--r-- | security/keys/request_key.c | 3 |
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) kdebug("- %u", key->serial); key_check(key); - /* Throw away the key data */ - if (key->type->destroy) + /* Throw away the key data if the key is instantiated */ + if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) && + !test_bit(KEY_FLAG_NEGATIVE, &key->flags) && + key->type->destroy) key->type->destroy(key); 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, kenter(""); + if (ctx->index_key.type == &key_type_keyring) + return ERR_PTR(-EPERM); + user = key_user_lookup(current_fsuid()); if (!user) return ERR_PTR(-ENOMEM); |
