userns: Convert sched_set_affinity and sched_set_scheduler's permission checks
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 3 Feb 2012 02:54:02 +0000 (18:54 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 3 May 2012 10:28:39 +0000 (03:28 -0700)
- 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>
kernel/sched/core.c

index 96bff855b8666e2f82dee00e611e46030bc68f3e..b189fecaef906043fdc8948089633c4a0ce7846d 100644 (file)
@@ -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;
 }