devcgroup: fix permission check when adding entry to child cgroup

# cat devices.list
 c 1:3 r
 # echo 'c 1:3 w' > sub/devices.allow
 # cat sub/devices.list
 c 1:3 w

As illustrated, the parent group has no write permission to /dev/null, so
it's child should not be allowed to add this write permission.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Li Zefan 2008-07-13 12:14:04 -07:00 committed by Linus Torvalds
parent 17d213f806
commit ec229e8300
1 changed files with 1 additions and 1 deletions

View File

@ -300,7 +300,7 @@ static int may_access_whitelist(struct dev_cgroup *c,
continue; continue;
if (whitem->minor != ~0 && whitem->minor != refwh->minor) if (whitem->minor != ~0 && whitem->minor != refwh->minor)
continue; continue;
if (refwh->access & (~(whitem->access | ACC_MASK))) if (refwh->access & (~whitem->access))
continue; continue;
return 1; return 1;
} }