WSL2-Linux-Kernel/security/keys
David Howells 34574dd10b keys: Handle there being no fallback destination keyring for request_key()
When request_key() is called, without there being any standard process
keyrings on which to fall back if a destination keyring is not specified, an
oops is liable to occur when construct_alloc_key() calls down_write() on
dest_keyring's semaphore.

Due to function inlining this may be seen as an oops in down_write() as called
from request_key_and_link().

This situation crops up during boot, where request_key() is called from within
the kernel (such as in CIFS mounts) where nobody is actually logged in, and so
PAM has not had a chance to create a session keyring and user keyrings to act
as the fallback.

To fix this, make construct_alloc_key() not attempt to cache a key if there is
no fallback key if no destination keyring is given specifically.

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-09 10:41:19 -07:00
..
Makefile keys: make the keyring quotas controllable through /proc/sys 2008-04-29 08:06:17 -07:00
compat.c keys: add keyctl function to get a security label 2008-04-29 08:06:16 -07:00
internal.h keys: distinguish per-uid keys in different namespaces 2009-02-27 12:35:06 +11:00
key.c keys: distinguish per-uid keys in different namespaces 2009-02-27 12:35:06 +11:00
keyctl.c keys: distinguish per-uid keys in different namespaces 2009-02-27 12:35:06 +11:00
keyring.c keys: skip keys from another user namespace 2009-02-27 12:35:12 +11:00
permission.c keys: consider user namespace in key_permission 2009-02-27 12:35:09 +11:00
proc.c keys: make procfiles per-user-namespace 2009-02-27 12:35:15 +11:00
process_keys.c keys: distinguish per-uid keys in different namespaces 2009-02-27 12:35:06 +11:00
request_key.c keys: Handle there being no fallback destination keyring for request_key() 2009-04-09 10:41:19 -07:00
request_key_auth.c CRED: Inaugurate COW credentials 2008-11-14 10:39:23 +11:00
sysctl.c keys: make the keyring quotas controllable through /proc/sys 2008-04-29 08:06:17 -07:00
user_defined.c