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 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors
Date: Tue, 11 Aug 2026 20:12:45 +0000 [thread overview]
Message-ID: <20260811201246.028D01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260811200013.185956-3-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] Missing cleanup of chained IRQ handlers triggers a Use-After-Free panic on probe failure.
- [High] Logic error due to false assumption of contiguous virtual IRQ numbers leads to unhandled INTx interrupts.
--
--- Patch [2]: [PATCH v3 2/3] PCI: rzg3s: Propagate platform_get_irq_byname() errors ---
commit 398dc4c2681ec621a5ea3ee51113abc78f26854a
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
PCI: rzg3s: Propagate platform_get_irq_byname() errors
platform_get_irq_byname() may return specific error codes such as
-EPROBE_DEFER, but rzg3s_pcie_init_irqdomain() replaces all failures
with -EINVAL. This commit propagates the original error code instead to
allow probe deferral.
> 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,
[Severity: High]
This is a pre-existing issue, but does this error path leave chained handlers
registered?
If rzg3s_pcie_init_irqdomain() successfully maps INTA but fails on a
subsequent INTx setup like an INTB probe deferral, returning directly leaves
the earlier chained handlers active. This same unhandled registration happens
if irq_domain_create_linear() fails later, or if the teardown function
omits unregistering the INTx chained handlers.
Since the device probe fails, the devres framework will free the host
structure. If the unhandled chained interrupt fires later, it will
dereference the freed host pointer, leading to a use-after-free panic:
rzg3s_pcie_intx_irq_handler()
struct rzg3s_pcie_host *host = irq_desc_get_handler_data(desc);
// UAF on host access
> "Failed to parse and map INT%c IRQ\n",
> 'A' + i);
>
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing the INTx
handling in this file, I noticed a potential issue in
rzg3s_pcie_intx_irq_handler().
Is the calculation for the INTx index assuming contiguous virtual IRQ numbers?
drivers/pci/controller/pcie-rzg3s-host.c:rzg3s_pcie_intx_irq_handler() {
...
u32 intx = irq - host->intx_irqs[0];
...
generic_handle_domain_irq(host->intx_domain, intx);
}
If the OS allocates non-contiguous virqs (for example, due to concurrent IRQ
allocation or ID reuse by the IDR), this calculation will yield an invalid
out-of-bounds index or underflow.
Can this cause the generic handler lookup to fail? If so, leaving the INTx
interrupt unhandled might lead to an IRQ storm that permanently disables
the interrupt line and breaks downstream PCIe devices.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260811200013.185956-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=2
next prev parent reply other threads:[~2026-08-11 20:12 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
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 [this message]
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=20260811201246.028D01F000E9@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