gpio: grgpio: Avoid potential NULL pointer dereference
PATCH 1/1 gpio: grgpio: Avoid potential NULL pointer dereference
irqmap is optional property, so priv->domain can be NULL if !irqmap. Thus add NULL test for priv->domain before calling irq_domain_remove() to prevent NULL pointer dereference.
Signed-off-by Axel Lin <[email protected]>
--- drivers/gpio/gpio-grgpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-grgpio.c +2 -1
@@ -441,7 +441,8 @@ static int grgpio_probe(struct platform_device *ofdev) err =gpiochip_add (gc);if (err) {dev_err (&ofdev->dev,"Could not add gpiochip\n" ); -irq_domain_remove (priv->domain); +if (priv->domain) +irq_domain_remove (priv->domain);return err; }
Signature · 1 line
1.9.1
Quoted 5 lines · Axel Lin
irqmap is optional property, so
priv->domaincan be NULL if !irqmap. Thus add NULL test forpriv->domainbefore callingirq_domain_remove()to prevent NULL pointer dereference.Signed-off-by Axel Lin <[email protected]>
Patch applied for fixes. Thanks!
Yours,
Linus Walleij