mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: 李广硕 <liguangshuo@mail.sdu.edu.cn>
Cc: stable@vger.kernel.org, Aaro Koskinen <aaro.koskinen@iki.fi>,
	Andreas Kemnade <andreas@kemnade.info>,
	Kevin Hilman <khilman@baylibre.com>,
	Roger Quadros <rogerq@kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	linux-omap@vger.kernel.org, mfd@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH 3/6] mfd: palmas: Fix potential IRQ action leaks on removal
Date: Thu, 19 Nov 2026 14:25:44 +0000	[thread overview]
Message-ID: <20261119142544.GR98456@joneslee-macbookpro.roam.internal> (raw)
In-Reply-To: <ACoAEgCeLDq4C5*UjRtdZKp9.3.1795092235677.Hmail.202321181@mail.sdu.edu.cn>

On Thu, 19 Nov 2026, 李广硕 wrote:

> 
> Hi Lee,
> 
> Thanks for the review.
> 
> From: Lee Jones <lee@kernel.org>
> Date: 2026-11-13 21:09:18
> To:  Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
> Cc:  stable@vger.kernel.org,Aaro Koskinen <aaro.koskinen@iki.fi>,Andreas Kemnade <andreas@kemnade.info>,Kevin Hilman <khilman@baylibre.com>,Roger Quadros <rogerq@kernel.org>,Tony Lindgren <tony@atomide.com>,linux-omap@vger.kernel.org,mfd@lists.linux.dev,linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 3/6] mfd: palmas: Fix potential IRQ action leaks on removal>On Sat, 31 Oct 2026, Guangshuo Li wrote:

Please reconfigure your mailer.  These headers shouldn't be in the body.

> >> The remove callback deletes the IRQ chip before managed OF children
> >> are removed. Their later free_irq() calls cannot find the disposed IRQ
> >> descriptors, potentially leaking interrupt actions. Depopulate the
> >> children before deleting the IRQ chip and auxiliary I2C clients.
> >>
> >> This issue was found by our static analysis tool under development.
> >>
> >> Fixes: 124e9deb1c40 ("mfd: palmas: Use devm_of_platform_populate()")
> >> Cc: stable@vger.kernel.org
> >> Assisted-by: OpenAI:gpt-6-astra
> >> Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
> >> ---
> >> Build-tested the changed object with x86_64 defconfig plus COMPILE_TEST
> >> and the driver dependencies (W=1).
> >> No runtime or fault-injection testing was performed.
> >>
> >>  drivers/mfd/palmas.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
> >> index 7fc886f4f80e..8a0b7b1e89d7 100644
> >> --- a/drivers/mfd/palmas.c
> >> +++ b/drivers/mfd/palmas.c
> >> @@ -677,6 +677,9 @@ static void palmas_i2c_remove(struct i2c_client *i2c)
> >>  	struct palmas *palmas = i2c_get_clientdata(i2c);
> >>  	int i;
> >>
> >> +	if (i2c->dev.of_node)
> >> +		devm_of_platform_depopulate(&i2c->dev);
> >
> >I think it would be nice to devm_* regmap_add_irq_chip() instead.
> >
> >If you also convert the auxiliary I2C clients and 'pm_power_off'
> >teardown to devm, you could drop palmas_i2c_remove() altogether.
> >
> >> +
> >>  	regmap_del_irq_chip(palmas->irq, palmas->irq_data);
> >>
> >>  	for (i = 1; i < PALMAS_NUM_CLIENTS; i++) {
> >
> >-- 
> >Lee Jones
> >
> 
> The IRQ chip is registered before devm_of_platform_populate(). With
> devm_regmap_add_irq_chip(), the children would be removed while their
> IRQ mappings are still valid.
> 
> If the auxiliary I2C clients and the power-off handler use managed
> cleanup too, I think palmas_i2c_remove() can go away. Is that what you
> had in mind? If so, I'll send a v2 for palmas along those lines.

Yes, that sounds about right.

-- 
Lee Jones

  reply	other threads:[~2026-11-19 14:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 16:54 [PATCH 0/6] mfd: Fix potential cleanup ordering and lifetime bugs Guangshuo Li
2026-10-30 16:54 ` [PATCH 1/6] mfd: da9055: Fix potential use-after-free during removal Guangshuo Li
2026-10-30 16:54 ` [PATCH 2/6] mfd: atc260x: Fix potential use-after-free on probe failure Guangshuo Li
2026-10-31 12:13   ` Cristian Ciocaltea
2026-10-30 16:54 ` [PATCH 3/6] mfd: palmas: Fix potential IRQ action leaks on removal Guangshuo Li
2026-11-13 13:09   ` Lee Jones
2026-11-19 12:43     ` 李广硕
2026-11-19 14:25       ` Lee Jones [this message]
2026-10-30 16:54 ` [PATCH 4/6] mfd: stmpe: Fix potential use-after-free during removal Guangshuo Li
2026-10-30 16:54 ` [PATCH 5/6] mfd: stmfx: Fix potential IRQ action leaks on removal Guangshuo Li
2026-10-30 16:54 ` [PATCH 6/6] mfd: wm8994: Fix potential use-after-free during removal Guangshuo Li
2026-11-13 14:06 ` (subset) [PATCH 0/6] mfd: Fix potential cleanup ordering and lifetime bugs Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119142544.GR98456@joneslee-macbookpro.roam.internal \
    --to=lee@kernel.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=khilman@baylibre.com \
    --cc=liguangshuo@mail.sdu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=rogerq@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®