]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched_ext: Sync error_irq_work before freeing scx_sched
authorTejun Heo <tj@kernel.org>
Thu, 9 Oct 2025 23:56:23 +0000 (13:56 -1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Nov 2025 13:18:02 +0000 (22:18 +0900)
[ Upstream commit efeeaac9ae9763f9c953e69633c86bc3031e39b5 ]

By the time scx_sched_free_rcu_work() runs, the scx_sched is no longer
reachable. However, a previously queued error_irq_work may still be pending or
running. Ensure it completes before proceeding with teardown.

Fixes: bff3b5aec1b7 ("sched_ext: Move disable machinery into scx_sched")
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/ext.c

index 46029050b170fe311e58e4a0777c5d9532def443..f89894476e51f2dc4c65cca18cf52e67f0b49ee0 100644 (file)
@@ -3537,7 +3537,9 @@ static void scx_sched_free_rcu_work(struct work_struct *work)
        struct scx_dispatch_q *dsq;
        int node;
 
+       irq_work_sync(&sch->error_irq_work);
        kthread_stop(sch->helper->task);
+
        free_percpu(sch->pcpu);
 
        for_each_node_state(node, N_POSSIBLE)