mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mfd: da9150: fix IRQ action memory leak on removal
@ 2026-10-27  3:08 Guangshuo Li
  2026-10-27 15:26 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Guangshuo Li @ 2026-10-27  3:08 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Adam Thomson, mfd, linux-kernel
  Cc: Guangshuo Li, stable

da9150_remove() currently removes the regmap IRQ chip before removing
the MFD child devices. regmap_del_irq_chip() disposes the child IRQ
mappings and removes their IRQ descriptors.

The GPADC child registers an interrupt handler using
devm_request_threaded_irq(). When the child device is subsequently
removed, its device-managed cleanup calls free_irq(), which can no
longer find the corresponding IRQ descriptor. As a result, the
allocated struct irqaction is not freed, causing a memory leak.
The associated IRQ thread also cannot be stopped normally.

Remove the MFD child devices first so their interrupt handlers are
released while the IRQ mappings are still valid. Then remove the
regmap IRQ chip and its IRQ domain.

This issue was found by our static analysis tool under development.

Fixes: b8fce55c09d3 ("mfd: Add support for DA9150 combined charger & fuel-gauge device")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/mfd/da9150-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c
index 5c59cc869fb3..1b6dbbed60e7 100644
--- a/drivers/mfd/da9150-core.c
+++ b/drivers/mfd/da9150-core.c
@@ -474,8 +474,8 @@ static void da9150_remove(struct i2c_client *client)
 {
 	struct da9150 *da9150 = i2c_get_clientdata(client);
 
-	regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
 	mfd_remove_devices(da9150->dev);
+	regmap_del_irq_chip(da9150->irq, da9150->regmap_irq_data);
 	i2c_unregister_device(da9150->core_qif);
 }
 
-- 
2.43.0


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

* Re: [PATCH] mfd: da9150: fix IRQ action memory leak on removal
  2026-10-27  3:08 [PATCH] mfd: da9150: fix IRQ action memory leak on removal Guangshuo Li
@ 2026-10-27 15:26 ` Krzysztof Kozlowski
  2026-10-27 16:21   ` Guangshuo Li
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-10-27 15:26 UTC (permalink / raw)
  To: Guangshuo Li, Support Opensource, Lee Jones, Adam Thomson, mfd,
	linux-kernel
  Cc: stable

On 27/10/2026 04:08, Guangshuo Li wrote:
> da9150_remove() currently removes the regmap IRQ chip before removing
> the MFD child devices. regmap_del_irq_chip() disposes the child IRQ
> mappings and removes their IRQ descriptors.
> 
> The GPADC child registers an interrupt handler using
> devm_request_threaded_irq(). When the child device is subsequently
> removed, its device-managed cleanup calls free_irq(), which can no
> longer find the corresponding IRQ descriptor. As a result, the
> allocated struct irqaction is not freed, causing a memory leak.
> The associated IRQ thread also cannot be stopped normally.
> 
> Remove the MFD child devices first so their interrupt handlers are
> released while the IRQ mappings are still valid. Then remove the
> regmap IRQ chip and its IRQ domain.
> 
> This issue was found by our static analysis tool under development.

So you just keep ignoring and ignoring our feedback. It's just bot, so
little point to discuss with bot.

Best regards,
Krzysztof

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

* Re: [PATCH] mfd: da9150: fix IRQ action memory leak on removal
  2026-10-27 15:26 ` Krzysztof Kozlowski
@ 2026-10-27 16:21   ` Guangshuo Li
  0 siblings, 0 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-10-27 16:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Support Opensource, Lee Jones, Adam Thomson, mfd, linux-kernel, stable

Hi Krzysztof,

On Tue, 27 Oct 2026 at 23:26, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 27/10/2026 04:08, Guangshuo Li wrote:
> > da9150_remove() currently removes the regmap IRQ chip before removing
> > the MFD child devices. regmap_del_irq_chip() disposes the child IRQ
> > mappings and removes their IRQ descriptors.
> >
> > The GPADC child registers an interrupt handler using
> > devm_request_threaded_irq(). When the child device is subsequently
> > removed, its device-managed cleanup calls free_irq(), which can no
> > longer find the corresponding IRQ descriptor. As a result, the
> > allocated struct irqaction is not freed, causing a memory leak.
> > The associated IRQ thread also cannot be stopped normally.
> >
> > Remove the MFD child devices first so their interrupt handlers are
> > released while the IRQ mappings are still valid. Then remove the
> > regmap IRQ chip and its IRQ domain.
> >
> > This issue was found by our static analysis tool under development.
>
> So you just keep ignoring and ignoring our feedback. It's just bot, so
> little point to discuss with bot.
>
> Best regards,
> Krzysztof

Thank you for your feedback, and I apologize if our recent submissions
gave the impression that we were ignoring your previous comments.

We did take your earlier suggestions into account and subsequently
submitted a patch series accordingly.

For the more recent patches, however, since they address issues in
different drivers, we thought it would be more appropriate to submit
them separately rather than group them into a single series.

We certainly did not intend to disregard your feedback. We appreciate
your time and guidance, and we will be more careful with our future
submissions.

Thank you for your understanding.

Best regards,
Guangshuo Li

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

end of thread, other threads:[~2026-10-27 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27  3:08 [PATCH] mfd: da9150: fix IRQ action memory leak on removal Guangshuo Li
2026-10-27 15:26 ` Krzysztof Kozlowski
2026-10-27 16:21   ` Guangshuo Li

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®