Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: linux-pci@vger.kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors
Date: Wed, 15 Jul 2026 22:45:16 +0000	[thread overview]
Message-ID: <20260715224516.9061C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715223019.3002237-3-prabhakar.mahadev-lad.rj@bp.renesas.com>

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

Pre-existing issues:
- [High] Failure to clear chained INTx IRQ handlers on error paths and during teardown leads to a use-after-free on probe failure.
- [High] System suspend path accesses AXI registers after disabling the PM domain, causing an asynchronous external abort.
- [High] INTx handler calculates hardware IRQ index assuming virtual IRQs are contiguous, which can lead to IRQ storms and lockups.
--

--- Patch [2]: [PATCH 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors ---
commit 24fb1c19eb92c4744be36d3ec0690bbefc19cef4
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

PCI: rzg3s: Propagate platform_get_irq_byname() errors

This commit modifies rzg3s_pcie_init_irqdomain() to propagate the specific
error code returned by platform_get_irq_byname() instead of overriding it
with -EINVAL. This ensures probe deferral works correctly if the interrupt
provider is not yet available.

> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index bd6471a7fb7a1..92371310d313b 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -975,7 +975,7 @@ static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host)
>  
>  		irq = platform_get_irq_byname(pdev, irq_name);
>  		if (irq < 0)
> -			return dev_err_probe(dev, -EINVAL,
> +			return dev_err_probe(dev, irq,
>  					     "Failed to parse and map INT%c IRQ\n",
>  					     'A' + i);
>  

[Severity: High]
This is a pre-existing issue, but returning directly from this loop on
error without cleaning up chained INTx handlers leads to a use-after-free.

If platform_get_irq_byname() fails for i > 0 (for example, by returning
-EPROBE_DEFER), does the driver leave chained handlers registered for the
previous iterations?

When the probe fails, the host structure is freed by devm.

If the parent interrupt fires during the probe deferral waiting period,
could the kernel execute rzg3s_pcie_intx_irq_handler() with a dangling
pointer?

Similarly, should rzg3s_pcie_teardown_irqdomain() clear these handlers?

It currently removes the IRQ domain but completely omits cleaning up the
INTx chained handlers, which might leave them dangling on unbind.


[Severity: High]
This is a pre-existing issue, but does the system suspend path access AXI
registers after disabling the PM domain?

In drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_suspend_noirq():

	ret = pm_runtime_put_sync(dev);
	if (ret)
		return ret;
	
	clk_disable_unprepare(port->refclk);
	
	/* SoC-specific de-initialization */
	ret = data->config_deinit(host);

This disables the power domain before executing SoC-specific
de-initialization.

For RZ/G3E, rzg3e_pcie_config_deinit() performs a writel_relaxed() to
host->axi + RZG3S_PCI_RESET.

Can accessing the AXI register space without clocks trigger a hardware fault?


[Severity: High]
This is a pre-existing issue, but does the INTx handler incorrectly assume
virtual IRQs are strictly contiguous?

In drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_intx_irq_handler():

	unsigned int irq = irq_desc_get_irq(desc);
	u32 intx = irq - host->intx_irqs[0];

This calculates the hardware interrupt index assuming dynamically allocated
virtual IRQ numbers from platform_get_irq_byname() are contiguous.

Because this driver opts into PROBE_PREFER_ASYNCHRONOUS, concurrent IRQ
allocations by other drivers could mean virqs are not sequential.

If intx evaluates to an out-of-bounds index, generic_handle_domain_irq()
will fail to find the mapping.

Could this leave the level-triggered INTx line asserted but unserviced,
resulting in an IRQ storm?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715223019.3002237-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=2

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 22:30 [PATCH 0/3] PCI: rzg3s: Fix issues in cleanup paths Prabhakar
2026-07-15 22:30 ` [PATCH 1/3] PCI: rzg3s: Disable refclk on probe failure Prabhakar
2026-07-15 22:43   ` sashiko-bot
2026-07-15 22:30 ` [PATCH 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors Prabhakar
2026-07-15 22:45   ` sashiko-bot [this message]
2026-07-15 22:30 ` [PATCH 3/3] PCI: rzg3s: Fix IRQ domain initialization error handling Prabhakar
2026-07-15 22:39   ` 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=20260715224516.9061C1F000E9@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