Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: gpio-mxc: 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().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/E1Z4z0C-0002SX-Lj@rmk-PC.arm.linux.org.uk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Russell King and committed by
Thomas Gleixner
e65eea54 7f77c5c3

+6 -7
+6 -7
drivers/gpio/gpio-mxc.c
··· 437 437 irq_set_chained_handler(port->irq, mx2_gpio_irq_handler); 438 438 } else { 439 439 /* setup one handler for each entry */ 440 - irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); 441 - irq_set_handler_data(port->irq, port); 442 - if (port->irq_high > 0) { 440 + irq_set_chained_handler_and_data(port->irq, 441 + mx3_gpio_irq_handler, port); 442 + if (port->irq_high > 0) 443 443 /* setup handler for GPIO 16 to 31 */ 444 - irq_set_chained_handler(port->irq_high, 445 - mx3_gpio_irq_handler); 446 - irq_set_handler_data(port->irq_high, port); 447 - } 444 + irq_set_chained_handler_and_data(port->irq_high, 445 + mx3_gpio_irq_handler, 446 + port); 448 447 } 449 448 450 449 err = bgpio_init(&port->bgc, &pdev->dev, 4,