From: Jarkko Nikula Date: Tue, 16 Sep 2014 13:23:15 +0000 (+0300) Subject: gpio: Fix potential NULL handler data in chained irqchip handler X-Git-Tag: v3.16.4~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02a4c4965393b98347f14947fa8d02aeab94be77;p=thirdparty%2Fkernel%2Fstable.git gpio: Fix potential NULL handler data in chained irqchip handler commit 324b0398781e7afb846378dd2d8a4374faaf236b upstream. There is possibility with misconfigured pins that interrupt occurs instantly after setting irq_set_chained_handler() in gpiochip_set_chained_irqchip(). Now if handler gets called before irq_set_handler_data() the handler gets NULL handler data. Fix this by moving irq_set_handler_data() call before irq_set_chained_handler() in gpiochip_set_chained_irqchip(). Reviewed-by: Alexandre Courbot Signed-off-by: Jarkko Nikula Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2ebc9071e3548..810c84fd00c49 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1368,12 +1368,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, return; } - irq_set_chained_handler(parent_irq, parent_handler); /* * The parent irqchip is already using the chip_data for this * irqchip, so our callbacks simply use the handler_data. */ irq_set_handler_data(parent_irq, gpiochip); + irq_set_chained_handler(parent_irq, parent_handler); } EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip);