]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sched_ext: Fix unsafe list iteration in process_ddsp_deferred_locals()
authorTejun Heo <tj@kernel.org>
Wed, 7 Aug 2024 20:17:38 +0000 (10:17 -1000)
committerTejun Heo <tj@kernel.org>
Thu, 8 Aug 2024 23:38:09 +0000 (13:38 -1000)
commit72763ea3d45c7f9fd69b825468afbf4d11c5ffc2
tree61aa7f11ecbdca19d25c62a2ae10bcc2290a5cbb
parent2c390dda9e03d7936c492224453342d458e9bf98
sched_ext: Fix unsafe list iteration in process_ddsp_deferred_locals()

process_ddsp_deferred_locals() executes deferred direct dispatches to the
local DSQs of remote CPUs. It iterates the tasks on
rq->scx.ddsp_deferred_locals list, removing and calling
dispatch_to_local_dsq() on each. However, the list is protected by the rq
lock that can be dropped by dispatch_to_local_dsq() temporarily, so the list
can be modified during the iteration, which can lead to oopses and other
failures.

Fix it by popping from the head of the list instead of iterating the list.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 5b26f7b920f7 ("sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches")
Acked-by: David Vernet <void@manifault.com>
kernel/sched/ext.c