mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
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
Date: Fri, 13 Nov 2026 13:09:18 +0000	[thread overview]
Message-ID: <179370041880.793788.14407997006744050474@kernel.org> (raw)
In-Reply-To: <fe4ee2ff4b3ad6675a46a169d6de6410db32b652.1793377422.git.liguangshuo@mail.sdu.edu.cn>

On Sat, 31 Oct 2026, Guangshuo Li wrote:

> 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

  reply	other threads:[~2026-11-13 13:09 UTC|newest]

Thread overview: 10+ 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 [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=179370041880.793788.14407997006744050474@kernel.org \
    --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®