Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330146
b: refs/heads/master
c: 66b8ef6
h: refs/heads/master
v: v3
  • Loading branch information
Aristeu Rozanski authored and Linus Torvalds committed Oct 5, 2012
1 parent 135125f commit 323eb58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 12ae6779332181432a7feda740735ffa5bb3d32d
refs/heads/master: 66b8ef67756b3051bf42a077a82c3c5c279caa5b
5 changes: 5 additions & 0 deletions trunk/security/device_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct dev_whitelist_item {
struct dev_cgroup {
struct cgroup_subsys_state css;
struct list_head whitelist;
bool deny_all;
};

static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s)
Expand Down Expand Up @@ -178,12 +179,14 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup *cgroup)
wh->minor = wh->major = ~0;
wh->type = DEV_ALL;
wh->access = ACC_MASK;
dev_cgroup->deny_all = false;
list_add(&wh->list, &dev_cgroup->whitelist);
} else {
parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup);
mutex_lock(&devcgroup_mutex);
ret = dev_whitelist_copy(&dev_cgroup->whitelist,
&parent_dev_cgroup->whitelist);
dev_cgroup->deny_all = parent_dev_cgroup->deny_all;
mutex_unlock(&devcgroup_mutex);
if (ret) {
kfree(dev_cgroup);
Expand Down Expand Up @@ -409,9 +412,11 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup,
case DEVCG_ALLOW:
if (!parent_has_perm(devcgroup, &wh))
return -EPERM;
devcgroup->deny_all = false;
return dev_whitelist_add(devcgroup, &wh);
case DEVCG_DENY:
dev_whitelist_rm(devcgroup, &wh);
devcgroup->deny_all = true;
break;
default:
return -EINVAL;
Expand Down

0 comments on commit 323eb58

Please sign in to comment.