From 09c5cb942f7545e53819ee2ca72fe843d23880e5 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 21 Jun 2015 21:00:30 +0200 Subject: m68k/psc: Fix race in installing chained IRQ handler Fix a race where a pending interrupt could be received and the handler called before the handler's data has been setup, by converting to irq_set_chained_handler_and_data(). Search and conversion was done with coccinelle: @@ expression E1, E2, E3; @@ ( -if (irq_set_chained_handler(E1, E3) != 0) - BUG(); | -irq_set_chained_handler(E1, E3); ) -irq_set_handler_data(E1, E2); +irq_set_chained_handler_and_data(E1, E3, E2); @@ expression E1, E2, E3; @@ ( -if (irq_set_chained_handler(E1, E3) != 0) - BUG(); ... | -irq_set_chained_handler(E1, E3); ... ) -irq_set_handler_data(E1, E2); +irq_set_chained_handler_and_data(E1, E3, E2); Reported-by: Russell King Signed-off-by: Thomas Gleixner Cc: Julia Lawall Cc: Joshua Thompson Cc: Geert Uytterhoeven Cc: linux-m68k@lists.linux-m68k.org --- arch/m68k/mac/psc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c index 835fa04511c8..272dde481d17 100644 --- a/arch/m68k/mac/psc.c +++ b/arch/m68k/mac/psc.c @@ -148,14 +148,10 @@ static void psc_irq(unsigned int irq, struct irq_desc *desc) void __init psc_register_interrupts(void) { - irq_set_chained_handler(IRQ_AUTO_3, psc_irq); - irq_set_handler_data(IRQ_AUTO_3, (void *)0x30); - irq_set_chained_handler(IRQ_AUTO_4, psc_irq); - irq_set_handler_data(IRQ_AUTO_4, (void *)0x40); - irq_set_chained_handler(IRQ_AUTO_5, psc_irq); - irq_set_handler_data(IRQ_AUTO_5, (void *)0x50); - irq_set_chained_handler(IRQ_AUTO_6, psc_irq); - irq_set_handler_data(IRQ_AUTO_6, (void *)0x60); + irq_set_chained_handler_and_data(IRQ_AUTO_3, psc_irq, (void *)0x30); + irq_set_chained_handler_and_data(IRQ_AUTO_4, psc_irq, (void *)0x40); + irq_set_chained_handler_and_data(IRQ_AUTO_5, psc_irq, (void *)0x50); + irq_set_chained_handler_and_data(IRQ_AUTO_6, psc_irq, (void *)0x60); } void psc_irq_enable(int irq) { -- cgit v1.2.3