mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/3] mfd: tps65217: Handle IRQ initialization errors
@ 2026-09-17 10:33 Жамбакиев Радий Рикардинович
  2026-09-17 10:33 ` [PATCH v4 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Жамбакиев Радий Рикардинович @ 2026-09-17 10:33 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Жамбакиев
	Радий
	Рикардинович,
	Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren,
	Lee Jones, Grygorii Strashko, Marcin Niestroj, linux-omap, mfd,
	linux-kernel, lvc-project

From: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>

The TPS65217 MFD driver does not validate the outcome of IRQ
initialisation: tps65217_probe() ignores the return value of
tps65217_irq_init(), so a failed irq_domain creation leaves the
driver bound with a NULL tps->irq_domain and the remove callback
oopses, and a failed write of the interrupt mask leaves the software
mask out of sync with the hardware.

On top of that the irq_domain is torn down in the wrong order: the
remove callback disposes the mappings and removes the domain before
the MFD children are unbound, so children that requested interrupts
(e.g. tps65217-charger) release virtual IRQs whose descriptors are
already disposed, and on probe failure the domain is leaked with its
host_data pointing to freed memory. The enable_irq_wake() in probe
is never balanced.

This series plugs the probe error paths and moves the domain and
wake-up teardown into devres, registered right after the domain is
created. Devres actions are released in reverse order of
registration, so on both removal and probe failure the MFD children
release their IRQs first, then the parent interrupt is freed and its
thread stopped, and only then is the domain removed.

Changes since v3:
  - No functional changes; applied the code-style fixes requested by
    Lee Jones.

Link: https://lore.kernel.org/all/20260904063439.69881-1-r.zhambakiev@prosoftsystems.ru/

Radiy Zhambakiev (3):
  mfd: tps65217: Fix NULL pointer dereference on IRQ init failure
  mfd: tps65217: Check return value when masking interrupt sources
  mfd: tps65217: Use devres for IRQ domain and wake teardown

 drivers/mfd/tps65217.c | 70 +++++++++++++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 21 deletions(-)

-- 
2.53.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-23  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 10:33 [PATCH v4 0/3] mfd: tps65217: Handle IRQ initialization errors Жамбакиев Радий Рикардинович
2026-09-17 10:33 ` [PATCH v4 1/3] mfd: tps65217: Fix NULL pointer dereference on IRQ init failure Жамбакиев Радий Рикардинович
2026-09-17 10:33 ` [PATCH v4 2/3] mfd: tps65217: Check return value when masking interrupt sources Жамбакиев Радий Рикардинович
2026-09-17 10:33 ` [PATCH v4 3/3] mfd: tps65217: Use devres for IRQ domain and wake teardown Жамбакиев Радий Рикардинович
2026-09-23  8:33   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®