From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: wsa+renesas@sang-engineering.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 1/3] PCI: rzg3s: Disable refclk on probe failure
Date: Tue, 11 Aug 2026 20:16:38 +0000 [thread overview]
Message-ID: <20260811201639.521741F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811200013.185956-2-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] System suspend is unconditionally aborted due to incorrect pm_runtime_put_sync() usage in the suspend_noirq phase.
- [High] Use-after-free vulnerability due to missing chained IRQ handler cleanup on probe error paths.
--
--- Patch [1]: [PATCH v3 1/3] PCI: rzg3s: Disable refclk on probe failure ---
commit 7f97e9f3db5d36293fbc8938e90e7f9e5ceaa52c
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
PCI: rzg3s: Disable refclk on probe failure
rzg3s_pcie_host_init_port() enables the PCIe reference clock using
clk_prepare_enable(), but if rzg3s_pcie_probe() subsequently fails, for
example because pci_host_probe() returns an error, the probe error path
only releases the clock handle with clk_put().
Balance clk_prepare_enable() by calling clk_disable_unprepare() in the
probe cleanup path before releasing the clock, ensuring the reference
clock is properly disabled on probe failure.
Fixes: 7ef502fb35b28 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index 66f687304c1cb..bd6471a7fb7a1 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -1762,6 +1762,7 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
> return 0;
>
> host_probe_teardown:
> + clk_disable_unprepare(host->port.refclk);
> rzg3s_pcie_teardown_irqdomain(host);
[Severity: High]
This is a pre-existing issue, but does this teardown path leave dangling
pointers in the chained IRQ handlers?
Looking at rzg3s_pcie_init_irqdomain(), chained handlers are registered
with the devres-managed host pointer:
drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_init_irqdomain() {
...
irq_set_chained_handler_and_data(irq,
rzg3s_pcie_intx_irq_handler,
host);
...
}
But rzg3s_pcie_teardown_irqdomain() does not clear them:
drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_teardown_irqdomain() {
if (IS_ENABLED(CONFIG_PCI_MSI))
rzg3s_pcie_teardown_msi(host);
irq_domain_remove(host->intx_domain);
}
If the probe fails and the host structure is freed, wouldn't a subsequent
spurious interrupt on any INTx line trigger a use-after-free when the chained
handler dereferences the freed host pointer?
Should this call irq_set_chained_handler_and_data() with NULL to clean up?
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file I
noticed a potential issue with the suspend sequence:
drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_suspend_noirq() {
...
ret = pm_runtime_put_sync(dev);
if (ret)
return ret;
...
}
Will this unconditionally abort the system suspend?
During the system suspend transition, the PM core disables runtime PM in the
suspend_late phase.
When suspend_noirq is later called, wouldn't pm_runtime_put_sync() return
-EACCES since runtime PM is disabled, causing the entire system suspend to
fail?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260811200013.185956-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=1
next prev parent reply other threads:[~2026-08-11 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 20:00 [PATCH v3 0/3] PCI: rzg3s: Fix issues in cleanup paths Prabhakar
2026-08-11 20:00 ` [PATCH v3 1/3] PCI: rzg3s: Disable refclk on probe failure Prabhakar
2026-08-11 20:16 ` sashiko-bot [this message]
2026-08-11 20:00 ` [PATCH v3 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors Prabhakar
2026-08-11 20:12 ` sashiko-bot
2026-08-11 20:00 ` [PATCH v3 3/3] PCI: rzg3s: Fix IRQ domain initialization error handling Prabhakar
2026-08-11 20:07 ` sashiko-bot
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=20260811201639.521741F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.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