Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Release cpus_read_lock on scx_link_sched() failure in root enable

scx_root_enable_workfn() takes cpus_read_lock() before
scx_link_sched(sch), but the `if (ret) goto err_disable` on failure
skips the matching cpus_read_unlock() - all other err_disable gotos
along this path drop the lock first.

scx_link_sched() only returns non-zero on the sub-sched path
(parent != NULL), so the leak path is unreachable via the root
caller today. Still, the unwind is out of line with the surrounding
paths.

Drop cpus_read_lock() before goto err_disable.

v2: Correct Fixes: tag (Andrea Righi).

Fixes: 25037af712eb ("sched_ext: Add rhashtable lookup for sub-schedulers")
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

+3 -1
+3 -1
kernel/sched/ext.c
··· 6736 6736 rcu_assign_pointer(scx_root, sch); 6737 6737 6738 6738 ret = scx_link_sched(sch); 6739 - if (ret) 6739 + if (ret) { 6740 + cpus_read_unlock(); 6740 6741 goto err_disable; 6742 + } 6741 6743 6742 6744 scx_idle_enable(ops); 6743 6745