* [PATCH 0/2] mfd: tps65217: Handle IRQ initialization errors
@ 2026-08-21 7:53 Жамбакиев Радий Рикардинович
2026-08-21 7:53 ` [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
2026-08-21 7:54 ` [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources Жамбакиев Радий Рикардинович
0 siblings, 2 replies; 5+ messages in thread
From: Жамбакиев Радий Рикардинович @ 2026-08-21 7:53 UTC (permalink / raw)
To: Aaro Koskinen
Cc: Жамбакиев Радий Рикардинович,
Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren,
Lee Jones, Grygorii Strashko, Marcin Niestroj,
linux-omap@vger.kernel.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
The tps65217 MFD driver ignores two error conditions when setting up
its interrupt handling, which can leave the driver bound in a broken
state. This series adds the missing error checks.
Patch 1 fixes a kernel crash: if the irq domain creation fails,
probe ignores the error and a later module unload dereferences the
NULL irq domain in tps65217_remove().
Patch 2 checks the error when masking all interrupt sources, so the
driver's software mask cannot diverge from the hardware state.
Radiy Zhambakiev (2):
mfd: tps65217: Fix NULL pointer dereference on IRQ init failure
mfd: tps65217: Check return value when masking interrupt sources
drivers/mfd/tps65217.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure
2026-08-21 7:53 [PATCH 0/2] mfd: tps65217: Handle IRQ initialization errors Жамбакиев Радий Рикардинович
@ 2026-08-21 7:53 ` Жамбакиев Радий Рикардинович
2026-08-21 9:55 ` Andreas Kemnade
2026-08-21 7:54 ` [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources Жамбакиев Радий Рикардинович
1 sibling, 1 reply; 5+ messages in thread
From: Жамбакиев Радий Рикардинович @ 2026-08-21 7:53 UTC (permalink / raw)
To: Aaro Koskinen
Cc: Жамбакиев Радий Рикардинович,
Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren,
Lee Jones, Grygorii Strashko, Marcin Niestroj,
linux-omap@vger.kernel.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
tps65217_probe() ignores the return value of tps65217_irq_init(), so
when the irq domain creation fails the probe still completes and the
driver ends up bound with a NULL tps->irq_domain. Unloading the
module then makes tps65217_remove() call irq_domain_remove() on the
NULL pointer and oops the kernel. On top of that, irq_find_mapping()
may fall back to the default irq domain and dispose of mappings that
belong to other interrupt controllers.
Check the return value and abort the probe on failure so the error
is reported and no inconsistent state is left for removal.
Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs")
Cc: stable@vger.kernel.org
Signed-off-by: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
---
drivers/mfd/tps65217.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index c240fac0ede7..2d04d9e0ae29 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -333,7 +333,9 @@ static int tps65217_probe(struct i2c_client *client)
}
if (client->irq) {
- tps65217_irq_init(tps, client->irq);
+ ret = tps65217_irq_init(tps, client->irq);
+ if (ret)
+ return ret;
} else {
int i;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources
2026-08-21 7:53 [PATCH 0/2] mfd: tps65217: Handle IRQ initialization errors Жамбакиев Радий Рикардинович
2026-08-21 7:53 ` [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
@ 2026-08-21 7:54 ` Жамбакиев Радий Рикардинович
2026-08-21 11:48 ` Andreas Kemnade
1 sibling, 1 reply; 5+ messages in thread
From: Жамбакиев Радий Рикардинович @ 2026-08-21 7:54 UTC (permalink / raw)
To: Aaro Koskinen
Cc: Жамбакиев Радий Рикардинович,
Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren,
Lee Jones, Grygorii Strashko, Marcin Niestroj,
linux-omap@vger.kernel.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
tps65217_irq_init() ignores the error returned by
tps65217_set_bits() when masking all interrupt sources. A failed
register write leaves the driver's software mask out of sync with the
hardware and may result in spurious interrupts.
Check the return value and propagate the error to the caller.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs")
Cc: stable@vger.kernel.org
Signed-off-by: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
---
drivers/mfd/tps65217.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
index 2d04d9e0ae29..9a1528456ffc 100644
--- a/drivers/mfd/tps65217.c
+++ b/drivers/mfd/tps65217.c
@@ -155,8 +155,13 @@ static int tps65217_irq_init(struct tps65217 *tps, int irq)
/* Mask all interrupt sources */
tps->irq_mask = TPS65217_INT_MASK;
- tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK,
- TPS65217_INT_MASK, TPS65217_PROTECT_NONE);
+ ret = tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK,
+ TPS65217_INT_MASK, TPS65217_PROTECT_NONE);
+ if (ret) {
+ dev_err(tps->dev, "Failed to mask interrupt sources: %d\n",
+ ret);
+ return ret;
+ }
tps->irq_domain = irq_domain_create_linear(dev_fwnode(tps->dev), TPS65217_NUM_IRQ,
&tps65217_irq_domain_ops, tps);
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure
2026-08-21 7:53 ` [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
@ 2026-08-21 9:55 ` Andreas Kemnade
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Kemnade @ 2026-08-21 9:55 UTC (permalink / raw)
To: Жамбакиев Радий Рикардинович
Cc: Aaro Koskinen, Kevin Hilman, Roger Quadros, Tony Lindgren,
Lee Jones, Grygorii Strashko, Marcin Niestroj,
linux-omap@vger.kernel.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
On Fri, 21 Aug 2026 07:53:58 +0000
Жамбакиев Радий Рикардинович <r.zhambakiev@prosoftsystems.ru> wrote:
> tps65217_probe() ignores the return value of tps65217_irq_init(), so
> when the irq domain creation fails the probe still completes and the
> driver ends up bound with a NULL tps->irq_domain. Unloading the
> module then makes tps65217_remove() call irq_domain_remove() on the
> NULL pointer and oops the kernel. On top of that, irq_find_mapping()
> may fall back to the default irq domain and dispose of mappings that
> belong to other interrupt controllers.
>
> Check the return value and abort the probe on failure so the error
> is reported and no inconsistent state is left for removal.
>
> Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> drivers/mfd/tps65217.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
> index c240fac0ede7..2d04d9e0ae29 100644
> --- a/drivers/mfd/tps65217.c
> +++ b/drivers/mfd/tps65217.c
> @@ -333,7 +333,9 @@ static int tps65217_probe(struct i2c_client *client)
> }
>
> if (client->irq) {
> - tps65217_irq_init(tps, client->irq);
> + ret = tps65217_irq_init(tps, client->irq);
> + if (ret)
> + return ret;
> } else {
> int i;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources
2026-08-21 7:54 ` [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources Жамбакиев Радий Рикардинович
@ 2026-08-21 11:48 ` Andreas Kemnade
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Kemnade @ 2026-08-21 11:48 UTC (permalink / raw)
To: Жамбакиев Радий Рикардинович
Cc: Aaro Koskinen, Kevin Hilman, Roger Quadros, Tony Lindgren,
Lee Jones, Grygorii Strashko, Marcin Niestroj,
linux-omap@vger.kernel.org, mfd@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
On Fri, 21 Aug 2026 07:54:02 +0000
Жамбакиев Радий Рикардинович <r.zhambakiev@prosoftsystems.ru> wrote:
> tps65217_irq_init() ignores the error returned by
> tps65217_set_bits() when masking all interrupt sources. A failed
> register write leaves the driver's software mask out of sync with the
> hardware and may result in spurious interrupts.
>
> Check the return value and propagate the error to the caller.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 6556bdacf646fcaa ("mfd: tps65217: Add support for IRQs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> drivers/mfd/tps65217.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c
> index 2d04d9e0ae29..9a1528456ffc 100644
> --- a/drivers/mfd/tps65217.c
> +++ b/drivers/mfd/tps65217.c
> @@ -155,8 +155,13 @@ static int tps65217_irq_init(struct tps65217 *tps, int irq)
>
> /* Mask all interrupt sources */
> tps->irq_mask = TPS65217_INT_MASK;
> - tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK,
> - TPS65217_INT_MASK, TPS65217_PROTECT_NONE);
> + ret = tps65217_set_bits(tps, TPS65217_REG_INT, TPS65217_INT_MASK,
> + TPS65217_INT_MASK, TPS65217_PROTECT_NONE);
> + if (ret) {
> + dev_err(tps->dev, "Failed to mask interrupt sources: %d\n",
> + ret);
> + return ret;
> + }
>
> tps->irq_domain = irq_domain_create_linear(dev_fwnode(tps->dev), TPS65217_NUM_IRQ,
> &tps65217_irq_domain_ops, tps);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-21 11:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 7:53 [PATCH 0/2] mfd: tps65217: Handle IRQ initialization errors Жамбакиев Радий Рикардинович
2026-08-21 7:53 ` [PATCH 1/2] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
2026-08-21 9:55 ` Andreas Kemnade
2026-08-21 7:54 ` [PATCH 2/2] mfd: tps65217: Check return value when masking interrupt sources Жамбакиев Радий Рикардинович
2026-08-21 11:48 ` Andreas Kemnade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox