linux-yocto/kernel/cgroup
Chen Ridong 1c71f3cf5f cgroup,freezer: fix incomplete freezing when attaching tasks
commit 37fb58a727 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: f5d39b0208 ("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>
2025-06-27 11:11:19 +01:00
..
cgroup-internal.h mm, memcg: cg2 memory{.swap,}.peak write handlers 2024-09-01 20:25:53 -07:00
cgroup-v1.c cgroup: Do not report unavailable v1 controllers in /proc/cgroups 2024-09-10 10:04:28 -10:00
cgroup.c cgroup: Fix compilation issue due to cgroup_mutex not being exported 2025-05-29 11:01:59 +02:00
cpuset-internal.h cgroup/cpuset: Don't allow creation of local partition over a remote one 2025-05-02 07:59:21 +02:00
cpuset-v1.c cgroup/cpuset: rename functions shared between v1 and v2 2024-08-30 10:00:16 -10:00
cpuset.c cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks 2025-05-22 14:29:35 +02:00
debug.c
freezer.c
legacy_freezer.c cgroup,freezer: fix incomplete freezing when attaching tasks 2025-06-27 11:11:19 +01:00
Makefile cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1 2024-08-30 10:00:16 -10:00
misc.c cgroup/misc: Introduce misc.events.local 2024-07-12 06:45:23 -10:00
namespace.c cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-08-14 14:29:47 -10:00
pids.c cgroup/pids: Remove unreachable paths of pids_{can,cancel}_fork 2024-08-05 10:32:16 -10:00
rdma.c rdmacg: fix kernel-doc warnings in rdmacg 2023-06-05 09:45:14 -10:00
rstat.c cgroup/rstat: avoid disabling irqs for O(num_cpu) 2025-05-29 11:02:10 +02:00