aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/process_keys.c
diff options
context:
space:
mode:
authorSerge E. Hallyn <serge@hallyn.com>2011-05-26 16:25:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 16:49:19 -0400
commitf7285b5d631fd6096b11c6af0058ed3a2b30ef4e (patch)
tree956fff16b2327818eae72cfe47cf2260986e2fd2 /security/keys/process_keys.c
parentb7c2f036284452627d793af981877817b37d4351 (diff)
Set cred->user_ns in key_replace_session_keyring
Since this cred was not created with copy_creds(), it needs to get initialized. Otherwise use of syscall(__NR_keyctl, KEYCTL_SESSION_TO_PARENT); can lead to a NULL deref. Thanks to Robert for finding this. But introduced by commit 47a150edc2a ("Cache user_ns in struct cred"). Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com> Reported-by: Robert Święcki <robert@swiecki.net> Cc: David Howells <dhowells@redhat.com> Cc: stable@kernel.org (2.6.39) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/keys/process_keys.c')
-rw-r--r--security/keys/process_keys.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 6c0480db8885..a3063eb3dc23 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -847,6 +847,7 @@ void key_replace_session_keyring(void)
847 new-> sgid = old-> sgid; 847 new-> sgid = old-> sgid;
848 new->fsgid = old->fsgid; 848 new->fsgid = old->fsgid;
849 new->user = get_uid(old->user); 849 new->user = get_uid(old->user);
850 new->user_ns = new->user->user_ns;
850 new->group_info = get_group_info(old->group_info); 851 new->group_info = get_group_info(old->group_info);
851 852
852 new->securebits = old->securebits; 853 new->securebits = old->securebits;