This is a note to let you know that I've just added the patch titled cgroup: Fix race condition at rebind_subsystems() to the 5.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cgroup-fix-race-condition-at-rebind_subsystems.patch and it can be found in the queue-5.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 763f4fb76e24959c370cdaa889b2492ba6175580 Mon Sep 17 00:00:00 2001 From: Jing-Ting Wu <Jing-Ting.Wu@xxxxxxxxxxxx> Date: Tue, 23 Aug 2022 13:41:46 +0800 Subject: cgroup: Fix race condition at rebind_subsystems() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jing-Ting Wu <Jing-Ting.Wu@xxxxxxxxxxxx> 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@xxxxxxxxxxxx> Suggested-by: Michal Koutný <mkoutny@xxxxxxxx> Signed-off-by: Jing-Ting Wu <jing-ting.wu@xxxxxxxxxxxx> Tested-by: Jing-Ting Wu <jing-ting.wu@xxxxxxxxxxxx> Link: https://lore.kernel.org/linux-arm-kernel/d8f0bc5e2fb6ed259f9334c83279b4c011283c41.camel@xxxxxxxxxxxx/T/ Acked-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx> Fixes: a7df69b81aac ("cgroup: rstat: support cgroup1") Cc: stable@xxxxxxxxxxxxxxx # v5.13+ Signed-off-by: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/cgroup/cgroup.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1811,6 +1811,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); } Patches currently in stable-queue which might be from Jing-Ting.Wu@xxxxxxxxxxxx are queue-5.19/cgroup-fix-race-condition-at-rebind_subsystems.patch