summaryrefslogtreecommitdiff
path: root/security/device_cgroup.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /security/device_cgroup.c
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'security/device_cgroup.c')
-rw-r--r--security/device_cgroup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 7c2a0a7..c123628 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -63,6 +63,16 @@ static inline struct dev_cgroup *task_devcgroup(struct task_struct *task)
struct cgroup_subsys devices_subsys;
+static int devcgroup_can_attach(struct cgroup_subsys_state *new_css,
+ struct cgroup_taskset *set)
+{
+ struct task_struct *task = cgroup_taskset_first(set);
+
+ if (current != task && !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ return 0;
+}
+
/*
* called under devcgroup_mutex
*/
@@ -687,6 +697,7 @@ static struct cftype dev_cgroup_files[] = {
struct cgroup_subsys devices_subsys = {
.name = "devices",
+ .can_attach = devcgroup_can_attach,
.css_alloc = devcgroup_css_alloc,
.css_free = devcgroup_css_free,
.css_online = devcgroup_online,