[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220829105804.818654067@linuxfoundation.org>
Date: Mon, 29 Aug 2022 12:57:51 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Jing-Ting Wu <jing-ting.wu@...iatek.com>,
Michal Koutný <mkoutny@...e.com>,
Mukesh Ojha <quic_mojha@...cinc.com>, Tejun Heo <tj@...nel.org>
Subject: [PATCH 5.15 004/136] cgroup: Fix race condition at rebind_subsystems()
From: Jing-Ting Wu <Jing-Ting.Wu@...iatek.com>
commit 763f4fb76e24959c370cdaa889b2492ba6175580 upstream.
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@...iatek.com>
Suggested-by: Michal Koutný <mkoutny@...e.com>
Signed-off-by: Jing-Ting Wu <jing-ting.wu@...iatek.com>
Tested-by: Jing-Ting Wu <jing-ting.wu@...iatek.com>
Link: https://lore.kernel.org/linux-arm-kernel/d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@mediatek.com/T/
Acked-by: Mukesh Ojha <quic_mojha@...cinc.com>
Fixes: a7df69b81aac ("cgroup: rstat: support cgroup1")
Cc: stable@...r.kernel.org # v5.13+
Signed-off-by: Tejun Heo <tj@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
kernel/cgroup/cgroup.c | 1 +
1 file changed, 1 insertion(+)
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1810,6 +1810,7 @@ int rebind_subsystems(struct cgroup_root
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);
}
Powered by blists - more mailing lists