summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo2014-04-23 17:13:15 +0200
committerTejun Heo2014-04-23 17:13:15 +0200
commite32978031016f56be977a9a856ba4d9f447db51f (patch)
treeda480e04bbbeaa3849f8ee19fd82936ce2421686 /kernel/cgroup.c
parentcgroup: teach css_task_iter about effective csses (diff)
downloadkernel-qcow2-linux-e32978031016f56be977a9a856ba4d9f447db51f.tar.gz
kernel-qcow2-linux-e32978031016f56be977a9a856ba4d9f447db51f.tar.xz
kernel-qcow2-linux-e32978031016f56be977a9a856ba4d9f447db51f.zip
cgroup: cgroup->subsys[] should be cleared after the css is offlined
After a css finishes offlining, offline_css() mistakenly performs RCU_INIT_POINTER(css->cgroup->subsys[ss->id], css) which just sets the cgroup->subsys[] pointer to the current value. The intention was to clear it after offline is complete, not reassign the same value. Update it to assign NULL instead of the current value. This makes cgroup_css() to return NULL once offline is complete. All the existing users of the function either can handle NULL return already or guarantee that the css doesn't get offlined. While this is a bugfix, as css lifetime is currently tied to the cgroup it belongs to, this bug doesn't cause any actual problems. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index ad28866ed44c..83a8fff43d68 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3710,7 +3710,7 @@ static void offline_css(struct cgroup_subsys_state *css)
css->flags &= ~CSS_ONLINE;
css->cgroup->nr_css--;
- RCU_INIT_POINTER(css->cgroup->subsys[ss->id], css);
+ RCU_INIT_POINTER(css->cgroup->subsys[ss->id], NULL);
}
/**