Revert "cgroup: Add generic cgroup subsystem permission checks."
authorColin Cross <ccross@android.com>
Wed, 13 Jul 2011 03:12:45 +0000 (20:12 -0700)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:19:08 +0000 (12:19 -0800)
This reverts commit 1d38bc7d0523af2233b4280e2aeab34c6a076665.

Change-Id: I2c5066b696cbdd5ca117ed74718bcb7e70e878e7
Signed-off-by: Colin Cross <ccross@android.com>
kernel/cgroup.c
kernel/cgroup_freezer.c
kernel/cpuset.c
kernel/sched.c

index 01ab75d..f6e7b4a 100644 (file)
@@ -58,7 +58,6 @@
 #include <linux/eventfd.h>
 #include <linux/poll.h>
 #include <linux/flex_array.h> /* used in cgroup_attach_proc */
-#include <linux/capability.h>
 
 #include <asm/atomic.h>
 
@@ -1844,15 +1843,6 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
                                failed_ss = ss;
                                goto out;
                        }
-               } else if (!capable(CAP_SYS_ADMIN)) {
-                       const struct cred *cred = current_cred(), *tcred;
-
-                       /* No can_attach() - check perms generically */
-                       tcred = __task_cred(tsk);
-                       if (cred->euid != tcred->uid &&
-                           cred->euid != tcred->suid) {
-                               return -EACCES;
-                       }
                }
                if (ss->can_attach_task) {
                        retval = ss->can_attach_task(cgrp, tsk);
index 6ebda1d..e691818 100644 (file)
@@ -164,14 +164,6 @@ static int freezer_can_attach(struct cgroup_subsys *ss,
 {
        struct freezer *freezer;
 
-       if ((current != task) && (!capable(CAP_SYS_ADMIN))) {
-               const struct cred *cred = current_cred(), *tcred;
-
-               tcred = __task_cred(task);
-               if (cred->euid != tcred->uid && cred->euid != tcred->suid)
-                       return -EPERM;
-       }
-
        /*
         * Anything frozen can't move or be moved to/from.
         */
index a1df487..9c9b754 100644 (file)
@@ -1373,13 +1373,6 @@ static int cpuset_can_attach(struct cgroup_subsys *ss, struct cgroup *cont,
 {
        struct cpuset *cs = cgroup_cs(cont);
 
-       if ((current != task) && (!capable(CAP_SYS_ADMIN))) {
-               const struct cred *cred = current_cred(), *tcred;
-
-               if (cred->euid != tcred->uid && cred->euid != tcred->suid)
-                       return -EPERM;
-       }
        if (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
                return -ENOSPC;
 
index c6186ea..fb3f656 100644 (file)
@@ -8944,15 +8944,6 @@ cpu_cgroup_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp)
 static int
 cpu_cgroup_can_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
 {
-       if ((current != tsk) && (!capable(CAP_SYS_NICE))) {
-               const struct cred *cred = current_cred(), *tcred;
-
-               tcred = __task_cred(tsk);
-
-               if (cred->euid != tcred->uid && cred->euid != tcred->suid)
-                       return -EPERM;
-       }
-
 #ifdef CONFIG_RT_GROUP_SCHED
        if (!sched_rt_can_attach(cgroup_tg(cgrp), tsk))
                return -EINVAL;