]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mfd: max77620: Fix potential IRQ chip conflict when probing two devices
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Thu, 23 Oct 2025 10:19:40 +0000 (12:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:42 +0000 (10:14 +0100)
commit8dda29c9950b2075e406f7079e6b56d6bb2849fb
tree8b1e1df57e4e8248eb0b80e4f976785b22808853
parent9b9e152a87ca4ae797d74d92232b159cb7ca7786
mfd: max77620: Fix potential IRQ chip conflict when probing two devices

commit 2bac49bad1f3553cc3b3bfb22cc194e9bd9e8427 upstream.

MAX77620 is most likely always a single device on the board, however
nothing stops board designers to have two of them, thus same device
driver could probe twice. Or user could manually try to probing second
time.

Device driver is not ready for that case, because it allocates
statically 'struct regmap_irq_chip' as non-const and stores during
probe in 'irq_drv_data' member a pointer to per-probe state
container ('struct max77620_chip').  devm_regmap_add_irq_chip() does not
make a copy of 'struct regmap_irq_chip' but store the pointer.

Second probe - either successful or failure - would overwrite the
'irq_drv_data' from previous device probe, so interrupts would be
executed in a wrong context.

Cc: stable@vger.kernel.org
Fixes: 3df140d11c6d ("mfd: max77620: Mask/unmask interrupt before/after servicing it")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20251023101939.67991-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mfd/max77620.c