diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-03-27 12:45:42 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-03-30 15:17:37 +0200 |
commit | 244b5a2344bce5d9675e02da65b24e026926348c (patch) | |
tree | 5a90e45458ce29a455851aeb5cda90c1e0b8cda4 /drivers/staging/greybus/gpio.c | |
parent | 1842dd8b7bc7d713d3c252a501411b5009b3987d (diff) |
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 <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/gpio.c')
-rw-r--r-- | drivers/staging/greybus/gpio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 7dc675d7bd5b..0500a6f58526 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(); |