Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ababae44 authored by Werner Pawlitschko's avatar Werner Pawlitschko Committed by Thomas Gleixner
Browse files

x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest()



Commit 4857c91f 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: 4857c91f "x86/ioapic: Force affinity setting in setup_ioapic_dest()"
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
parent 298a96c1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2547,6 +2547,8 @@ void __init setup_ioapic_dest(void)
			mask = apic->target_cpus();

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