]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/sched_ext: Fix select_cpu_dfl link leak on early return
authorCheng-Yang Chou <yphbchou0911@gmail.com>
Fri, 8 May 2026 06:55:12 +0000 (14:55 +0800)
committerTejun Heo <tj@kernel.org>
Fri, 8 May 2026 15:34:39 +0000 (05:34 -1000)
commite18002d2c791456546505d64f308981f38316ca9
treeff25bbd348d57ec3748d0a89d339ed5e65e76a8e
parentd91b36de53c563f6f65aa1dea747f9bcb4c56d1d
selftests/sched_ext: Fix select_cpu_dfl link leak on early return

If run() exits early via SCX_EQ/SCX_ASSERT (which calls return
directly), bpf_link__destroy() is never reached and the BPF
scheduler stays loaded. All subsequent tests then fail to attach
because SCX is not in the DISABLED state.

Move bpf_link into a context struct so cleanup() always destroys
it, regardless of how run() exits. Also skip waitpid() for children
where fork() returned -1, avoiding waitpid(-1,...) accidentally
reaping an unrelated child and triggering the early return path.

Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
tools/testing/selftests/sched_ext/select_cpu_dfl.c