Commit d8b15363 authored by Jing-Ting Wu's avatar Jing-Ting Wu Committed by Zheng Zengkai
Browse files

cgroup: Fix race condition at rebind_subsystems()

mainline inclusion
from mainline-v6.0-rc3
commit 763f4fb7
category: bugfix
bugzilla: 187794, https://gitee.com/openeuler/kernel/issues/I5ZXVK
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=763f4fb76e24959c370cdaa889b2492ba6175580



-------------------------------

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: default avatarJing-Ting Wu <jing-ting.wu@mediatek.com>
Suggested-by: default avatarMichal Koutný <mkoutny@suse.com>
Signed-off-by: default avatarJing-Ting Wu <jing-ting.wu@mediatek.com>
Tested-by: default avatarJing-Ting Wu <jing-ting.wu@mediatek.com>
Link: https://lore.kernel.org/linux-arm-kernel/d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com/T/


Acked-by: default avatarMukesh Ojha <quic_mojha@quicinc.com>
Fixes: a7df69b8 ("cgroup: rstat: support cgroup1")
Cc: stable@vger.kernel.org # v5.13+
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarCai Xinchen <caixinchen1@huawei.com>
Reviewed-by: default avatarGONG Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: default avatarWang Weiyang <wangweiyang2@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent cc99be91
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment