mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 23:57:36 -04:00
gpio: mt7621: be sure IRQ domain is created before exposing GPIO chips
Function 'mediatek_gpio_bank_probe()' registers three GPIO chips using
'devm_gpiochip_add_data()'. At this point, the chips become live and visible
to consumers. However, the IRQ domain isn't allocated and set up until
'mt7621_gpio_irq_setup()' is called after the GPIO chips setup finishes.
If a consumer requests a GPIO IRQ concurrently 'mt7621_gpio_to_irq()' can
be called and pass a NULL irq domain pointer irq_create_mapping(), that can
corrupt the mappings or cause a crash. Fix this possible problem seting up
irq domain before GPIO chips setup is performed.
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: a46f2e5720 ("gpio: mt7621: fix interrupt banks mapping on gpio chips")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://patch.msgid.link/20260626060112.2498324-4-sergio.paracuellos@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
839738536a
commit
0e024f5829
@@ -466,12 +466,6 @@ mediatek_gpio_probe(struct platform_device *pdev)
|
||||
mtk->num_gpios = MTK_BANK_WIDTH * MTK_BANK_CNT;
|
||||
platform_set_drvdata(pdev, mtk);
|
||||
|
||||
for (i = 0; i < MTK_BANK_CNT; i++) {
|
||||
ret = mediatek_gpio_bank_probe(dev, i);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (mtk->gpio_irq > 0) {
|
||||
ret = mt7621_gpio_irq_setup(pdev, mtk);
|
||||
if (ret)
|
||||
@@ -482,6 +476,12 @@ mediatek_gpio_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < MTK_BANK_CNT; i++) {
|
||||
ret = mediatek_gpio_bank_probe(dev, i);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user