提交 763f4fb7 编写于 作者: J Jing-Ting Wu 提交者: Tejun Heo

cgroup: Fix race condition at rebind_subsystems()

Root cause:
The rebind_subsystems() is no lock held when move css object from A
list to B list,then let B's head be treated as css node at
list_for_each_entry_rcu().

Solution:
Add grace period before invalidating the removed rstat_css_node.
Reported-by: NJing-Ting Wu <jing-ting.wu@mediatek.com>
Suggested-by: NMichal Koutný <mkoutny@suse.com>
Signed-off-by: NJing-Ting Wu <jing-ting.wu@mediatek.com>
Tested-by: NJing-Ting Wu <jing-ting.wu@mediatek.com>
Link: https://lore.kernel.org/linux-arm-kernel/d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com/T/Acked-by: NMukesh Ojha <quic_mojha@quicinc.com>
Fixes: a7df69b8 ("cgroup: rstat: support cgroup1")
Cc: stable@vger.kernel.org # v5.13+
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 4f7e7236
......@@ -1820,6 +1820,7 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)
if (ss->css_rstat_flush) {
list_del_rcu(&css->rstat_css_node);
synchronize_rcu();
list_add_rcu(&css->rstat_css_node,
&dcgrp->rstat_css_list);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册