Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7285b5d authored by Serge E. Hallyn's avatar Serge E. Hallyn Committed by Linus Torvalds
Browse files

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 47a150ed ("Cache user_ns in struct cred").

Signed-off-by: default avatarSerge E. Hallyn <serge.hallyn@canonical.com>
Reported-by: default avatarRobert Święcki <robert@swiecki.net>
Cc: David Howells <dhowells@redhat.com>
Cc: stable@kernel.org (2.6.39)
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b7c2f036
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -847,6 +847,7 @@ void key_replace_session_keyring(void)
	new-> sgid	= old-> sgid;
	new-> sgid	= old-> sgid;
	new->fsgid	= old->fsgid;
	new->fsgid	= old->fsgid;
	new->user	= get_uid(old->user);
	new->user	= get_uid(old->user);
	new->user_ns	= new->user->user_ns;
	new->group_info	= get_group_info(old->group_info);
	new->group_info	= get_group_info(old->group_info);


	new->securebits	= old->securebits;
	new->securebits	= old->securebits;