summaryrefslogtreecommitdiffstats
path: root/security/keys/request_key.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-08-06 17:08:27 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-06 18:17:02 +0200
commit1e456a124353a753e9d1fadfbf5cd459c2f197ae (patch)
tree4977d4fa275faafc0ba99a635d4c853a1f0df2a1 /security/keys/request_key.c
parentMerge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git... (diff)
downloadlinux-1e456a124353a753e9d1fadfbf5cd459c2f197ae.tar.xz
linux-1e456a124353a753e9d1fadfbf5cd459c2f197ae.zip
KEYS: request_key() should return -ENOKEY if the constructed key is negative
request_key() should return -ENOKEY if the key it constructs has been negatively instantiated. Without this, request_key() can return an unusable key to its caller, and if the caller then does key_validate() that won't catch the problem. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/keys/request_key.c')
-rw-r--r--security/keys/request_key.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 0d26f689bd77..0088dd8bf68a 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -537,6 +537,8 @@ int wait_for_key_construction(struct key *key, bool intr)
intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
if (ret < 0)
return ret;
+ if (test_bit(KEY_FLAG_NEGATIVE, &key->flags))
+ return -ENOKEY;
return key_validate(key);
}
EXPORT_SYMBOL(wait_for_key_construction);