]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cgroup,freezer: fix incomplete freezing when attaching tasks
authorChen Ridong <chenridong@huawei.com>
Wed, 18 Jun 2025 07:32:17 +0000 (07:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:11:19 +0000 (11:11 +0100)
commit1c71f3cf5f91b30358e25c50bf15c4a4396384bd
treec0aad394250c2ce1091cf56f558c908aabb02d82
parent5d555f17d18bd8e09aec21f637f6fe14029930ea
cgroup,freezer: fix incomplete freezing when attaching tasks

commit 37fb58a7273726e59f9429c89ade5116083a213d upstream.

An issue was found:

# cd /sys/fs/cgroup/freezer/
# mkdir test
# echo FROZEN > test/freezer.state
# cat test/freezer.state
FROZEN
# sleep 1000 &
[1] 863
# echo 863 > test/cgroup.procs
# cat test/freezer.state
FREEZING

When tasks are migrated to a frozen cgroup, the freezer fails to
immediately freeze the tasks, causing the cgroup to remain in the
"FREEZING".

The freeze_task() function is called before clearing the CGROUP_FROZEN
flag. This causes the freezing() check to incorrectly return false,
preventing __freeze_task() from being invoked for the migrated task.

To fix this issue, clear the CGROUP_FROZEN state before calling
freeze_task().

Fixes: f5d39b020809 ("freezer,sched: Rewrite core freezer logic")
Cc: stable@vger.kernel.org # v6.1+
Reported-by: Zhong Jiawei <zhongjiawei1@huawei.com>
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Acked-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/cgroup/legacy_freezer.c