From: Tao Cui Date: Mon, 11 May 2026 06:15:08 +0000 (+0800) Subject: selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=5b72759aa0c9fb6fb44da0d62ef749bfaed868dc;p=thirdparty%2Fkernel%2Flinux.git selftests/cgroup: fix child process escaping to parent cleanup in test_cpucg_nice In test_cpucg_nice, the forked child process incorrectly jumps to the parent's cleanup label on cg_write failure. This causes the child to attempt cg_destroy on cgroups the parent is still using, and then return to main() to continue executing tests as if it were the parent. Replace goto cleanup with exit(EXIT_FAILURE) in the child process. Signed-off-by: Tao Cui Signed-off-by: Tejun Heo --- diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c index c83f05438d7c..7a40d76b9548 100644 --- a/tools/testing/selftests/cgroup/test_cpu.c +++ b/tools/testing/selftests/cgroup/test_cpu.c @@ -278,7 +278,7 @@ static int test_cpucg_nice(const char *root) char buf[64]; snprintf(buf, sizeof(buf), "%d", getpid()); if (cg_write(cpucg, "cgroup.procs", buf)) - goto cleanup; + exit(EXIT_FAILURE); /* Try to keep niced CPU usage as constrained to hog_cpu as possible */ nice(1);