Skip to content

Commit d661684

Browse files
amlutodavem330
authored andcommitted
net: Check the correct namespace when spoofing pid over SCM_RIGHTS
This is a security bug. The follow-up will fix nsproxy to discourage this type of issue from happening again. Cc: stable@vger.kernel.org Signed-off-by: Andy Lutomirski <luto@amacapital.net> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dd5746b commit d661684

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/core/scm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static __inline__ int scm_check_creds(struct ucred *creds)
5454
return -EINVAL;
5555

5656
if ((creds->pid == task_tgid_vnr(current) ||
57-
ns_capable(current->nsproxy->pid_ns->user_ns, CAP_SYS_ADMIN)) &&
57+
ns_capable(task_active_pid_ns(current)->user_ns, CAP_SYS_ADMIN)) &&
5858
((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) ||
5959
uid_eq(uid, cred->suid)) || nsown_capable(CAP_SETUID)) &&
6060
((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) ||

0 commit comments

Comments
 (0)