* [PATCH] gpio: grgpio: Avoid potential NULL pointer dereference
@ 2014-12-20 14:47 Axel Lin
2015-01-08 19:14 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-12-20 14:47 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: Andreas Larsson, linux-gpio@vger.kernel.org
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 <axel.lin@ingics.com>
---
drivers/gpio/gpio-grgpio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c
index 09daaf2..3a5a710 100644
--- a/drivers/gpio/gpio-grgpio.c
+++ b/drivers/gpio/gpio-grgpio.c
@@ -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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: grgpio: Avoid potential NULL pointer dereference
2014-12-20 14:47 [PATCH] gpio: grgpio: Avoid potential NULL pointer dereference Axel Lin
@ 2015-01-08 19:14 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2015-01-08 19:14 UTC (permalink / raw)
To: Axel Lin; +Cc: Alexandre Courbot, Andreas Larsson, linux-gpio@vger.kernel.org
On Sat, Dec 20, 2014 at 3:47 PM, Axel Lin <axel.lin@ingics.com> wrote:
> 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 <axel.lin@ingics.com>
Patch applied for fixes. Thanks!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-08 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-20 14:47 [PATCH] gpio: grgpio: Avoid potential NULL pointer dereference Axel Lin
2015-01-08 19:14 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).