All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yige Jiang" <yigejiang86@gmail.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH] pmdomain: imx: gpcv2: Take a reference to each PGC node
Date: Mon, 23 Nov 2026 17:28:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-229745@kernel.org> (raw)
In-Reply-To: <confirmed-20261105-18-6a8421e1b241@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] pmdomain: imx: gpcv2: use-after-free in imx_gpcv2_probe()
  [1]
--

commit c3636a65fc3cbb73598f1158474f8ad80341a10d
Author: Yige Jiang <yigejiang86@gmail.com>

pmdomain: imx: gpcv2: Take a reference to each PGC node

This commit replaces device_set_node() with platform_device_set_of_node() in
imx_gpcv2_probe() so each child platform device holds its own reference to the
device tree node.

> diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
> index 6a54ee7345146..7b377bf019649 100644
> --- a/drivers/pmdomain/imx/gpcv2.c
> +++ b/drivers/pmdomain/imx/gpcv2.c
> @@ -1513,7 +1513,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
>  		domain->genpd.power_off = imx_pgc_power_down;
>  
>  		pd_pdev->dev.parent = dev;
> -		device_set_node(&pd_pdev->dev, of_fwnode_handle(np));
> +		platform_device_set_of_node(pd_pdev, np);
>  
>  		ret = platform_device_add(pd_pdev);
>  		if (ret) {

[Severity: Critical]
This problem wasn't introduced by this patch, but can returning an error from
this loop [1] leave earlier child pd_pdev devices registered with a
dangling domain->regmap pointer?

When platform_device_add() or platform_device_add_data() fails on a later
child node, imx_gpcv2_probe() returns without unregistering the child platform
devices added in previous iterations.  The failure of imx_gpcv2_probe() then
releases the parent device's devm-managed regmap and MMIO mapping, so any
later power domain operation on the remaining child devices will cause a
use-after-free on domain->regmap.

[1] https://sashiko.dev/#/bug/linux-e1374cb3-5de8-4163-b459-98d74ba7a1e1

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/confirmed-20261105-18-6a8421e1b241@gmail.com?part=1

  reply	other threads:[~2026-11-23 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:19 [PATCH] pmdomain: imx: gpcv2: Take a reference to each PGC node Yige Jiang
2026-11-23 17:28 ` sashiko-bot [this message]
2026-11-26 13:31 ` Ulf Hansson

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=sashiko-outbox-229745@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yigejiang86@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.