From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Stable <stable@vger.kernel.org>
Subject: [PATCH] gpio: Fix potentially NULL handler data passed to chained irqchip handler
Date: Tue, 16 Sep 2014 16:23:15 +0300 [thread overview]
Message-ID: <1410873795-31980-1-git-send-email-jarkko.nikula@linux.intel.com> (raw)
There is possibility with misconfigured pins that interrupt occurs instantly
after setting irq_set_chained_handler() in gpiochip_set_chained_irqchip().
Now if handler gets called before irq_set_handler_data() the handler gets
NULL handler data.
Fix this by moving irq_set_handler_data() call before
irq_set_chained_handler() in gpiochip_set_chained_irqchip().
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Stable <stable@vger.kernel.org> # 3.15+
---
I noticed this while debugging why commit e1ee5c578fb1 ("pinctrl: baytrail:
Convert to use gpiolib irqchip") was showing a regression on a development
machine with a few misconfigured pins by the BIOS. For those pins
drivers/pinctrl/pinctrl-baytrail.c: byt_gpio_irq_handler() was often called
instantly with handler data being NULL and dummy if (vg == NULL) return;
test there didn't allow code further in byt_gpio_irq_handler() to disable
those flooding pins.
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 15cc0bb65dda..ed3f518e4337 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -413,12 +413,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
return;
}
- irq_set_chained_handler(parent_irq, parent_handler);
/*
* The parent irqchip is already using the chip_data for this
* irqchip, so our callbacks simply use the handler_data.
*/
irq_set_handler_data(parent_irq, gpiochip);
+ irq_set_chained_handler(parent_irq, parent_handler);
}
EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip);
--
2.1.0
next reply other threads:[~2014-09-16 13:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 13:23 Jarkko Nikula [this message]
2014-09-19 7:39 ` [PATCH] gpio: Fix potentially NULL handler data passed to chained irqchip handler Alexandre Courbot
2014-09-24 7:48 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410873795-31980-1-git-send-email-jarkko.nikula@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).