diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-06-21 20:16:09 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-06-25 11:57:04 +0200 |
commit | 1e105921368b10b941bdbf252a156dc6171a6a6b (patch) | |
tree | 409042a3d119fbe83f5e360bdb239e5403c921dd /drivers/pinctrl/mediatek | |
parent | 2cf5a03cb29debb00681a8af1dfa9179b43404d1 (diff) | |
download | linux-rpi3-1e105921368b10b941bdbf252a156dc6171a6a6b.tar.gz linux-rpi3-1e105921368b10b941bdbf252a156dc6171a6a6b.tar.bz2 linux-rpi3-1e105921368b10b941bdbf252a156dc6171a6a6b.zip |
pinctrl/mediatek: Fix race in installing chained IRQ handler
Fix a race where a pending interrupt could be received and the handler
called before the handler's data has been setup, by converting to
irq_set_chained_handler_and_data().
Search and conversion was done with coccinelle:
@@
expression E1, E2, E3;
@@
(
-if (irq_set_chained_handler(E1, E3) != 0)
- BUG();
|
-irq_set_chained_handler(E1, E3);
)
-irq_set_handler_data(E1, E2);
+irq_set_chained_handler_and_data(E1, E3, E2);
@@
expression E1, E2, E3;
@@
(
-if (irq_set_chained_handler(E1, E3) != 0)
- BUG();
...
|
-irq_set_chained_handler(E1, E3);
...
)
-irq_set_handler_data(E1, E2);
+irq_set_chained_handler_and_data(E1, E3, E2);
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Hongzhou Yang <hongzhou.yang@mediatek.com>
Cc: Axel Lin <axel.lin@ingics.com>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
Cc: Maoguang Meng <maoguang.meng@mediatek.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index 474812e2b0cb..26c42a1e74ed 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -1242,8 +1242,7 @@ int mtk_pctrl_init(struct platform_device *pdev, set_irq_flags(virq, IRQF_VALID); }; - irq_set_chained_handler(irq, mtk_eint_irq_handler); - irq_set_handler_data(irq, pctl); + irq_set_chained_handler_and_data(irq, mtk_eint_irq_handler, pctl); set_irq_flags(irq, IRQF_VALID); return 0; |