Skip to content

Commit 6ff53f6

Browse files
sean-jcbonzini
authored andcommitted
x86/irq: Ensure PI wakeup handler is unregistered before module unload
Add a synchronize_rcu() after clearing the posted interrupt wakeup handler to ensure all readers, i.e. in-flight IRQ handlers, see the new handler before returning to the caller. If the caller is an exiting module and is unregistering its handler, failure to wait could result in the IRQ handler jumping into an unloaded module. The registration path doesn't require synchronization, as it's the caller's responsibility to not generate interrupts it cares about until after its handler is registered. Fixes: f6b3c72 ("x86/irq: Define a global vector for VT-d Posted-Interrupts") Cc: [email protected] Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 187c883 commit 6ff53f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kernel/irq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ void kvm_set_posted_intr_wakeup_handler(void (*handler)(void))
291291
{
292292
if (handler)
293293
kvm_posted_intr_wakeup_handler = handler;
294-
else
294+
else {
295295
kvm_posted_intr_wakeup_handler = dummy_handler;
296+
synchronize_rcu();
297+
}
296298
}
297299
EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler);
298300

0 commit comments

Comments
 (0)