diff options
author | Tejun Heo <tj@kernel.org> | 2013-08-15 11:42:36 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-19 09:56:25 -0400 |
commit | 0bfb4aa67cef4982adc70590a31624d7b35a0bda (patch) | |
tree | 89a20d8b76a803e2ac6e04c032b97e35f392fd8f /Kbuild | |
parent | 1cb650b91ba582f6737457b7d22e368585596d2c (diff) |
cgroup: fix subsystem file accesses on the root cgroup
105347ba5 ("cgroup: make cgroup_file_open() rcu_read_lock() around
cgroup_css() and add cfent->css") added cfent->css to cache the
associted cgroup_subsys_state across file operations.
A cfent is associated with single css throughout its lifetime and the
origimal commit initialized the cache pointer during cgroup_add_file()
and verified that it matches the actual one in cgroup_file_open().
While this works fine for !root cgroups, it's broken for root cgroups
as files in a root cgroup are created before the css's are associated
with the cgroup and thus cgroup_css() call in cgroup_add_file()
returns NULL associating all cfents in the root cgroup with NULL css.
This makes cgroup_file_open() trigger WARN and fail with -ENODEV for
all !core subsystem files in the root cgroups.
There's no reason to initialize cfent->css separately from
cgroup_add_file(). As the association never changes,
cgroup_file_open() can set it unconditionally every time and
containing the logic in cgroup_file_open() makes more sense anyway as
the only reason it's necessary is file->private_data being already
occupied.
Fix it by setting cfent->css unconditionally from cgroup_file_open().
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'Kbuild')
0 files changed, 0 insertions, 0 deletions