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 b23c0979bbe7..328f1e7ed782 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1383,6 +1383,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;