summaryrefslogtreecommitdiffstats
path: root/security/keys/request_key.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-09-24 11:35:13 +0200
committerDavid Howells <dhowells@redhat.com>2013-09-24 11:35:13 +0200
commit61ea0c0ba904a55f55317d850c1072ff7835ac92 (patch)
tree259f6872bc88d1cb4e94e405d5273c6dbc678175 /security/keys/request_key.c
parentselinux: add Paul Moore as a SELinux maintainer (diff)
downloadlinux-61ea0c0ba904a55f55317d850c1072ff7835ac92.tar.xz
linux-61ea0c0ba904a55f55317d850c1072ff7835ac92.zip
KEYS: Skip key state checks when checking for possession
Skip key state checks (invalidation, revocation and expiration) when checking for possession. Without this, keys that have been marked invalid, revoked keys and expired keys are not given a possession attribute - which means the possessor is not granted any possession permits and cannot do anything with them unless they also have one a user, group or other permit. This causes failures in the keyutils test suite's revocation and expiration tests now that commit 96b5c8fea6c0861621051290d705ec2e971963f1 reduced the initial permissions granted to a key. The failures are due to accesses to revoked and expired keys being given EACCES instead of EKEYREVOKED or EKEYEXPIRED. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r--security/keys/request_key.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index c411f9bb156b..172115b38054 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -390,7 +390,8 @@ static int construct_alloc_key(struct key_type *type,
* waited for locks */
mutex_lock(&key_construction_mutex);
- key_ref = search_process_keyrings(type, description, type->match, cred);
+ key_ref = search_process_keyrings(type, description, type->match,
+ false, cred);
if (!IS_ERR(key_ref))
goto key_already_present;
@@ -539,7 +540,8 @@ struct key *request_key_and_link(struct key_type *type,
dest_keyring, flags);
/* search all the process keyrings for a key */
- key_ref = search_process_keyrings(type, description, type->match, cred);
+ key_ref = search_process_keyrings(type, description, type->match,
+ false, cred);
if (!IS_ERR(key_ref)) {
key = key_ref_to_ptr(key_ref);