]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched_ext: INIT_LIST_HEAD() &sch->all in scx_alloc_and_add_sched()
authorTejun Heo <tj@kernel.org>
Mon, 11 May 2026 23:18:19 +0000 (13:18 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 12 May 2026 21:28:56 +0000 (11:28 -1000)
On scx_link_sched() error paths (parent disabled, hash insert failure),
&sch->all is never added to scx_sched_all. The cleanup path runs
scx_unlink_sched() unconditionally, which calls list_del_rcu(&sch->all) on a
list_head that was never initialized triggering a corruption warning.

Initialize &sch->all.

Fixes: 54be8de4236a ("sched_ext: Factor out scx_link_sched() and scx_unlink_sched()")
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 68120f679178dad07a88cf7d5fbca1238e0ec066..6d69ba29cfd77c3943fb9328d4084a4d16e643f6 100644 (file)
@@ -6635,6 +6635,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops,
        rcu_assign_pointer(ops->priv, sch);
 
        sch->kobj.kset = scx_kset;
+       INIT_LIST_HEAD(&sch->all);
 
 #ifdef CONFIG_EXT_SUB_SCHED
        char *buf = kzalloc(PATH_MAX, GFP_KERNEL);