Skip to contentSkip to conversation

sched_ext: Fix use of uninitialized variable in scx_bpf_cpuperf_set()

PATCH Applied Andrea Righi 3 participants 3 messages Oct 29, 2025

Subsystems (2)
lore
Share & tools
lore

Andrea Righi

author reviewer
#0 lore raw

PATCH 1/1 sched_ext: Fix use of uninitialized variable in scx_bpf_cpuperf_set()

scx_bpf_cpuperf_set() has a typo where it dereferences the local variable @sch, instead of the global @scx_root pointer. Fix by dereferencing the correct variable.

Fixes 956f2b11a8a4f ("sched_ext: Drop kf_cpu_valid()")
---
 kernel/sched/ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/ext.c +1 -1
index ecb251e883eab..1a019a7728fb2 100644
@@ -6401,7 +6401,7 @@ __bpf_kfunc void scx_bpf_cpuperf_set(s32 cpu, u32 perf)
 
 	guard(rcu)();
 
-	sch = rcu_dereference(sch);
+	sch = rcu_dereference(scx_root);
 	if (unlikely(!sch))
 		return;
 
Signature · 1 line
2.51.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Andrea Righi

scx_bpf_cpuperf_set() has a typo where it dereferences the local variable @sch, instead of the global @scx_root pointer. Fix by dereferencing the correct variable.

Fixes 956f2b11a8a4f ("sched_ext: Drop kf_cpu_valid()")
---
 kernel/sched/ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/ext.c +0 -0
index ecb251e883eab..1a019a7728fb2 100644

kernel/sched/ext.c __bpf_kfunc void scx_bpf_cpuperf_set(s32 cpu, u32 perf) · line 6407

Quoted 8 lines
kernel/sched/ext.c +1 -1
@@ -6401,7 +6401,7 @@ __bpf_kfunc void scx_bpf_cpuperf_set(s32 cpu, u32 perf)
 
 	guard(rcu)();
 
-	sch = rcu_dereference(sch);
+	sch = rcu_dereference(scx_root);
 	if (unlikely(!sch))
 		return;