Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Commit e2c8568

Browse files
committed
scx: Fix error condition check in __scx_bpf_consume_task()
__scx_bpf_consume_task() should test whether the task is still on the DSQ that's being iterated before erroring out if it's on a local DSQ. Otherwise, another racing consumer can move the task to a local DSQ triggering a spurious error. Relocate the error condition.
1 parent c952e64 commit e2c8568

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/sched/ext.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6092,14 +6092,14 @@ __bpf_kfunc bool __scx_bpf_consume_task(unsigned long it, struct task_struct *p)
60926092
*/
60936093
dsq = READ_ONCE(p->scx.dsq);
60946094

6095+
if (unlikely(!dsq || dsq != kit_dsq))
6096+
return false;
6097+
60956098
if (unlikely(dsq->id == SCX_DSQ_LOCAL)) {
60966099
scx_ops_error("local DSQ not allowed");
60976100
return false;
60986101
}
60996102

6100-
if (unlikely(!dsq || dsq != kit_dsq))
6101-
return false;
6102-
61036103
if (!scx_kf_allowed(SCX_KF_DISPATCH))
61046104
return false;
61056105

0 commit comments

Comments
 (0)