Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fabio Estevam" <festevam@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2] irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable()
Date: Wed, 29 Jul 2026 22:22:45 +0000	[thread overview]
Message-ID: <20260729222246.24B551F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729221416.499781-1-festevam@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Adding devm_pm_runtime_enable() introduces a failure path that fails to deregister chained IRQ handlers, leading to a Use-After-Free.

Pre-existing issues:
- [High] The irq_domain created during probe is leaked and left registered on error paths, creating a dangling pointer risk.
--

--- Patch [1]: [PATCH v2] irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable() ---
commit 3959004c7e2715ec92cba0eb90ac30fdaf1b65c2
Author: Fabio Estevam <festevam@gmail.com>
Subject: irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable()

This commit converts the driver to use devm_pm_runtime_enable() to
automatically disable runtime PM when the device is removed, fixing an
unbalanced pm_runtime_enable warning.

> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index 87b07f517be35..ba1203d3edd4d 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
> @@ -263,7 +263,9 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, data);
>  
>  	pm_runtime_set_active(&pdev->dev);
> -	pm_runtime_enable(&pdev->dev);
> +	ret = devm_pm_runtime_enable(&pdev->dev);
> +	if (ret)
> +		goto out;

[Severity: High]
If devm_pm_runtime_enable() fails, does this new error path leave the chained
IRQ handlers registered?

Earlier in imx_irqsteer_probe(), we register the chained handlers:

    for (i = 0; i < data->irq_count; i++) {
        ...
        irq_set_chained_handler_and_data(data->irq[i],
                                         imx_irqsteer_irq_handler,
                                         data);
    }

When we jump to the "out" label on failure, devres will free the "data"
structure. If a parent IRQ fires after this, could imx_irqsteer_irq_handler()
dereference the freed pointer?

>  
>  	return 0;
>  out:

[Severity: High]
This is a pre-existing issue, but does this error path also leak the IRQ
domain?

Earlier in probe, the domain is created:

    data->domain = irq_domain_create_linear(dev_fwnode(&pdev->dev), ...

The "out" label only disables the IPG clock, but doesn't call
irq_domain_remove(). Is it possible that the IRQ domain is left registered
in the system with its host_data pointing to the freed "data" structure,
leading to a use-after-free if IRQ mappings are attempted later?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729221416.499781-1-festevam@gmail.com?part=1

  reply	other threads:[~2026-07-29 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 22:14 [PATCH v2] irqchip: imx-irqsteer: Convert to devm_pm_runtime_enable() Fabio Estevam
2026-07-29 22:22 ` sashiko-bot [this message]
2026-07-30  2:22 ` Radu Rendec

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=20260729222246.24B551F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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