From: Johan Hovold Date: Fri, 27 Mar 2015 11:45:42 +0000 (+0100) Subject: greybus: gpio: fix null-deref on unexpected irq requests X-Git-Tag: v4.14-rc1~2366^2~378^2~21^2~1633 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=244b5a2344bce5d9675e02da65b24e026926348c;p=platform%2Fkernel%2Flinux-rpi.git greybus: gpio: fix null-deref on unexpected irq requests Fix null-pointer dereference on failure to look up irq due to missing error handling. Signed-off-by: Johan Hovold Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 7dc675d..0500a6f 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -425,7 +425,15 @@ static void gb_gpio_request_recv(u8 type, struct gb_operation *op) return; } irq = gpio_to_irq(ggc->chip.base + event->which); + if (irq < 0) { + dev_err(ggc->chip.dev, "failed to map irq\n"); + return; + } desc = irq_to_desc(irq); + if (!desc) { + dev_err(ggc->chip.dev, "failed to look up irq\n"); + return; + } /* Dispatch interrupt */ local_irq_disable();