]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: gpio: fix null-deref on unexpected irq requests
authorJohan Hovold <johan@hovoldconsulting.com>
Fri, 27 Mar 2015 11:45:42 +0000 (12:45 +0100)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 30 Mar 2015 13:17:37 +0000 (15:17 +0200)
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>
drivers/staging/greybus/gpio.c

index 7dc675d7bd5ba05bb9dd5706ce11c6824258fe33..0500a6f585268cb7b00c7345d7aa2c9395fa4e58 100644 (file)
@@ -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();