Skip to content

Commit

Permalink
userns: Convert sched_set_affinity and sched_set_scheduler's permissi…
Browse files Browse the repository at this point in the history
…on checks

- Compare kuids with uid_eq
- kuid are uniuqe across all user namespaces so there is no longer the
  need for a user_namespace comparison.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed May 3, 2012
1 parent 76b6db0 commit 9c806aa
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4042,11 +4042,8 @@ static bool check_same_owner(struct task_struct *p)

rcu_read_lock();
pcred = __task_cred(p);
if (cred->user_ns == pcred->user_ns)
match = (cred->euid == pcred->euid ||
cred->euid == pcred->uid);
else
match = false;
match = (uid_eq(cred->euid, pcred->euid) ||
uid_eq(cred->euid, pcred->uid));
rcu_read_unlock();
return match;
}
Expand Down

0 comments on commit 9c806aa

Please sign in to comment.