Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Cc: aaro.koskinen@iki.fi, andreas@kemnade.info, khilman@baylibre.com,
	rogerq@kernel.org, tony@atomide.com, j-keerthy@ti.com,
	mfd@lists.linux.dev, linux-omap@vger.kernel.org,
	liguangshuo@mail.sdu.edu.cn
Subject: Re: [PATCH 2/2] mfd: tps65218: Fix potential use-after-free by child devices
Date: Wed, 2 Dec 2026 16:26:02 +0000	[thread overview]
Message-ID: <20261202162602.GK43081@kernel.org> (raw)
In-Reply-To: <20261126132803.4091137-3-202300460064@mail.sdu.edu.cn>

On Thu, 26 Nov 2026, Tian Xuechen wrote:

> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> 
> The MFD children are not removed on unbind, although the parent context
> and IRQ chip are device-managed. The children can retain access to
> released resources.
> 
> Use managed MFD registration to remove the children before the IRQ chip
> and parent context are released.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: 44b4dc616365 ("mfd: tps65218: Add driver for the TPS65218 PMIC")

This is not correct.  It should be:

4531156db726 ("mfd: tps65218: Use mfd_add_devices instead of of_platform_populate")

> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
>  drivers/mfd/tps65218.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c
> index 491c379a1a0f..12bef7a11471 100644
> --- a/drivers/mfd/tps65218.c
> +++ b/drivers/mfd/tps65218.c
> @@ -328,9 +328,9 @@ static int tps65218_probe(struct i2c_client *client)
>  	if (ret)
>  		return ret;
>  
> -	ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells,
> -			      ARRAY_SIZE(tps65218_cells), NULL, 0,
> -			      regmap_irq_get_domain(tps->irq_data));
> +	ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells,
> +				   ARRAY_SIZE(tps65218_cells), NULL, 0,
> +				   regmap_irq_get_domain(tps->irq_data));
>  
>  	return ret;

Why not return directly whilst you're at it?

-- 
Lee Jones

      reply	other threads:[~2026-12-02 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 13:28 [PATCH 0/2] mfd: Remove LP873x and TPS65218 child devices on teardown Tian Xuechen
2026-11-26 13:28 ` [PATCH 1/2] mfd: lp873x: Remove the child devices on unbind Tian Xuechen
2026-12-02 16:26   ` Lee Jones
2026-11-26 13:28 ` [PATCH 2/2] mfd: tps65218: Fix potential use-after-free by child devices Tian Xuechen
2026-12-02 16:26   ` Lee Jones [this message]

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=20261202162602.GK43081@kernel.org \
    --to=lee@kernel.org \
    --cc=202300460064@mail.sdu.edu.cn \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=j-keerthy@ti.com \
    --cc=khilman@baylibre.com \
    --cc=liguangshuo@mail.sdu.edu.cn \
    --cc=linux-omap@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=rogerq@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