summaryrefslogtreecommitdiff
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index e92e9818903..e210b3d3008 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1382,6 +1382,13 @@ static int cpuset_can_attach(struct cgroup_subsys *ss, struct cgroup *cont,
int ret;
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;