aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorNikita Shubin <nikita.shubin@maquefel.me>2020-12-10 10:05:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-30 11:53:51 +0100
commit2d9284c18862480bcabb331088692b51c70dad2c (patch)
treea2a55249c24ce04d78ac9230f69fae17031073ad /drivers/gpio/gpiolib.c
parent78d22dd9894293e5380b01e948670593ff408cff (diff)
downloadkernel_replicant_linux-2d9284c18862480bcabb331088692b51c70dad2c.tar.gz
kernel_replicant_linux-2d9284c18862480bcabb331088692b51c70dad2c.tar.bz2
kernel_replicant_linux-2d9284c18862480bcabb331088692b51c70dad2c.zip
gpiolib: irq hooks: fix recursion in gpiochip_irq_unmask
[ Upstream commit 9d5522199505c761575c8ea31dcfd9a2a8d73614 ] irqchip shared with multiple gpiochips, leads to recursive call of gpiochip_irq_mask/gpiochip_irq_unmask which was assigned to rqchip->irq_mask/irqchip->irq_unmask, these happens becouse of only irqchip->irq_enable == gpiochip_irq_enable is checked. Let's add an additional check to make sure shared irqchip is detected even if irqchip->irq_enable wasn't defined. Fixes: a8173820f441 ("gpio: gpiolib: Allow GPIO IRQs to lazy disable") Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> Link: https://lore.kernel.org/r/20201210070514.13238-1-nikita.shubin@maquefel.me Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 6e3c4d7a7d14..4ad3c4b276dc 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1477,7 +1477,8 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc)
if (WARN_ON(gc->irq.irq_enable))
return;
/* Check if the irqchip already has this hook... */
- if (irqchip->irq_enable == gpiochip_irq_enable) {
+ if (irqchip->irq_enable == gpiochip_irq_enable ||
+ irqchip->irq_mask == gpiochip_irq_mask) {
/*
* ...and if so, give a gentle warning that this is bad
* practice.