Skip to content

Commit ababae4

Browse files
Werner PawlitschkoKAGA-KOKO
Werner Pawlitschko
authored andcommitted
x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest()
Commit 4857c91 changed the way how irq affinity is setup in setup_ioapic_dest() from using the core helper function to unconditionally calling the irq_set_affinity() callback of the underlying irq chip. That results in a NULL pointer dereference for the rare case where the underlying irq chip is lapic_chip which has no irq_set_affinity() callback. lapic_chip is occasionally used for the timer interrupt (irq 0). The fix is simple: Check the availability of the callback instead of calling it unconditionally. Fixes: 4857c91 "x86/ioapic: Force affinity setting in setup_ioapic_dest()" Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org
1 parent 298a96c commit ababae4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/x86/kernel/apic/io_apic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,9 @@ void __init setup_ioapic_dest(void)
25472547
mask = apic->target_cpus();
25482548

25492549
chip = irq_data_get_irq_chip(idata);
2550-
chip->irq_set_affinity(idata, mask, false);
2550+
/* Might be lapic_chip for irq 0 */
2551+
if (chip->irq_set_affinity)
2552+
chip->irq_set_affinity(idata, mask, false);
25512553
}
25522554
}
25532555
#endif

0 commit comments

Comments
 (0)