Skip to content

Commit

Permalink
KEYS: request_key() should return -ENOKEY if the constructed key is n…
Browse files Browse the repository at this point in the history
…egative

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>
  • Loading branch information
David Howells authored and Linus Torvalds committed Aug 6, 2010
1 parent fc1caf6 commit 1e456a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security/keys/request_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1e456a1

Please sign in to comment.