summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorTejun Heo2015-09-18 23:54:23 +0200
committerTejun Heo2015-09-18 23:54:23 +0200
commit7dbdb199d3bf88f043ea17e97113eb28d5b100bc (patch)
tree648451cd5f719dafe1c01a18cf2a7903d6166f93 /mm/memcontrol.c
parentcgroup: replace "cgroup.populated" with "cgroup.events" (diff)
downloadkernel-qcow2-linux-7dbdb199d3bf88f043ea17e97113eb28d5b100bc.tar.gz
kernel-qcow2-linux-7dbdb199d3bf88f043ea17e97113eb28d5b100bc.tar.xz
kernel-qcow2-linux-7dbdb199d3bf88f043ea17e97113eb28d5b100bc.zip
cgroup: replace cftype->mode with CFTYPE_WORLD_WRITABLE
cftype->mode allows controllers to give arbitrary permissions to interface knobs. Except for "cgroup.event_control", the existing uses are spurious. * Some explicitly specify S_IRUGO | S_IWUSR even though that's the default. * "cpuset.memory_pressure" specifies S_IRUGO while also setting a write callback which returns -EACCES. All it needs to do is simply not setting a write callback. "cgroup.event_control" uses cftype->mode to make the file world-writable. It's a misdesigned interface and we don't want controllers to be tweaking interface file permissions in general. This patch removes cftype->mode and all its spurious uses and implements CFTYPE_WORLD_WRITABLE for "cgroup.event_control" which is marked as compatibility-only. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b35c4cc47a30..e672f2689326 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4060,8 +4060,7 @@ static struct cftype mem_cgroup_legacy_files[] = {
{
.name = "cgroup.event_control", /* XXX: for compat */
.write = memcg_write_event_control,
- .flags = CFTYPE_NO_PREFIX,
- .mode = S_IWUGO,
+ .flags = CFTYPE_NO_PREFIX | CFTYPE_WORLD_WRITABLE,
},
{
.name = "swappiness",