aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-03-12 18:44:39 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-05-15 17:59:30 -0400
commit14a590c3f987977d7b09ec926481ee0238c08eee (patch)
treeb06a1f674d090abde07bbaca03f53fbe3f346609
parent8751e03958f2adbfba6a0f186f4c5797c950c22a (diff)
userns: Convert cgroup permission checks to use uid_eq
Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/cgroup.c6
2 files changed, 3 insertions, 4 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 7a5ccb2e9e0f..d24cc75caf65 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -865,7 +865,6 @@ config UIDGID_CONVERTED
865 865
866 # List of kernel pieces that need user namespace work 866 # List of kernel pieces that need user namespace work
867 # Features 867 # Features
868 depends on CGROUPS = n
869 depends on MIGRATION = n 868 depends on MIGRATION = n
870 depends on NUMA = n 869 depends on NUMA = n
871 depends on SYSVIPC = n 870 depends on SYSVIPC = n
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index ed64ccac67c9..c8329b0c2576 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2160,9 +2160,9 @@ retry_find_task:
2160 * only need to check permissions on one of them. 2160 * only need to check permissions on one of them.
2161 */ 2161 */
2162 tcred = __task_cred(tsk); 2162 tcred = __task_cred(tsk);
2163 if (cred->euid && 2163 if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) &&
2164 cred->euid != tcred->uid && 2164 !uid_eq(cred->euid, tcred->uid) &&
2165 cred->euid != tcred->suid) { 2165 !uid_eq(cred->euid, tcred->suid)) {
2166 rcu_read_unlock(); 2166 rcu_read_unlock();
2167 ret = -EACCES; 2167 ret = -EACCES;
2168 goto out_unlock_cgroup; 2168 goto out_unlock_cgroup;