]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cgroup: Increment nr_dying_subsys_* from rmdir context
authorPetr Malat <oss@malat.biz>
Thu, 23 Apr 2026 09:48:26 +0000 (04:48 -0500)
committerTejun Heo <tj@kernel.org>
Thu, 23 Apr 2026 17:37:40 +0000 (07:37 -1000)
commit13e786b64bd3fd81c7eb22aa32bf8305c32f2ccf
tree737cdad0adf2c7a04691bcbf31dab67485785fc5
parent41d701ddc36d5301b44ea79529f3cf03c541c1e1
cgroup: Increment nr_dying_subsys_* from rmdir context

Incrementing nr_dying_subsys_* in offline_css(), which is executed by
cgroup_offline_wq worker, leads to a race where user can see the value
to be 0 if he reads cgroup.stat after calling rmdir and before the worker
executes. This makes the user wrongly expect resources released by the
removed cgroup to be available for a new assignment.

Increment nr_dying_subsys_* from kill_css(), which is called from the
cgroup_rmdir() context.

Fixes: ab0312526867 ("cgroup: Show # of subsystem CSSes in cgroup.stat")
Signed-off-by: Petr Malat <oss@malat.biz>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cgroup.c