cgroup: avoid accessing modular cgroup subsys structure without locking
authorLi Zefan <lizefan@huawei.com>
Tue, 5 Mar 2013 02:57:03 +0000 (10:57 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 5 Mar 2013 17:33:25 +0000 (09:33 -0800)
subsys[i] is set to NULL in cgroup_unload_subsys() at modular unload,
and that's protected by cgroup_mutex, and then the memory *subsys[i]
resides will be freed.

So this is unsafe without any locking:

  if (!ss || ss->module)
  ...

v2:
- add a comment for enum cgroup_subsys_id
- simplify the comment in cgroup_exit()

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

No differences found