Skip to content

Commit

Permalink
x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Werner Pawlitschko authored and Thomas Gleixner committed Oct 27, 2015
1 parent 298a96c commit ababae4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kernel/apic/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2547,7 +2547,9 @@ void __init setup_ioapic_dest(void)
mask = apic->target_cpus();

chip = irq_data_get_irq_chip(idata);
chip->irq_set_affinity(idata, mask, false);
/* Might be lapic_chip for irq 0 */
if (chip->irq_set_affinity)
chip->irq_set_affinity(idata, mask, false);
}
}
#endif
Expand Down

0 comments on commit ababae4

Please sign in to comment.