]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: Fix race condition at rebind_subsystems()
authorJing-Ting Wu <Jing-Ting.Wu@mediatek.com>
Tue, 23 Aug 2022 05:41:46 +0000 (13:41 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 23 Aug 2022 18:11:06 +0000 (08:11 -1000)
commitd1a0e4e23123d1691acd429692f72b0327185843
tree541e52a6ef13de29f061d5a3a90eedabb4938e5f
parentc816169ad60e4e64b73d03b23012f670e3af6945
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: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Suggested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Tested-by: Jing-Ting Wu <jing-ting.wu@mediatek.com>
Link: https://lore.kernel.org/linux-arm-kernel/d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com/T/
Acked-by: Mukesh Ojha <quic_mojha@quicinc.com>
Fixes: a254b5ec2c3a ("cgroup: rstat: support cgroup1")
Cc: stable@vger.kernel.org # v5.13+
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cgroup.c