Skip to content
Commit e6cd1e07 authored by Milton Miller's avatar Milton Miller Committed by Linus Torvalds
Browse files

call_function_many: fix list delete vs add race



Peter pointed out there was nothing preventing the list_del_rcu in
smp_call_function_interrupt from running before the list_add_rcu in
smp_call_function_many.

Fix this by not setting refs until we have gotten the lock for the list.
Take advantage of the wmb in list_add_rcu to save an explicit additional
one.

I tried to force this race with a udelay before the lock & list_add and
by mixing all 64 online cpus with just 3 random cpus in the mask, but
was unsuccessful.  Still, inspection shows a valid race, and the fix is
a extension of the existing protection window in the current code.

Cc: stable@kernel.org (v2.6.32 and later)
Reported-by: default avatarPeter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ef2b4b95
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment