Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Claudiu Beznea" <claudiu.beznea@kernel.org>
Cc: wsa+renesas@sang-engineering.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 6/8] PCI: rzg3s-host: Move IRQ domain setup code
Date: Tue, 22 Sep 2026 14:58:42 +0000	[thread overview]
Message-ID: <20260922145842.DA3C61F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260922144629.586997-7-claudiu.beznea@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] pci: UAF in rzg3s_pcie_teardown_intx() due to inverted teardown order
- [Medium] pci: silent removal of PCI_EXP_LNKCTL2_TLS configuration
--

commit 3b9e569b1b1720a0862f47115eba6a10d96f3784
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

PCI: rzg3s-host: Move IRQ domain setup code

Subsequent patches add support for the event IRQ to handle link
up/down events. The event IRQ handler will use
rzg3s_pcie_set_max_link_speed(). In preparation for adding event IRQ
support, move the IRQ domain initialization code after
rzg3s_pcie_set_max_link_speed().

> PCI: rzg3s-host: Move IRQ domain setup code

[Severity: Medium]
The commit message indicates this is a refactoring commit to move IRQ domain
setup code. Is the hardware target link speed configuration
(PCI_EXP_LNKCTL2_TLS) silently omitted from rzg3s_pcie_set_max_link_speed()
in this patch?

Omitting the hardware target link speed configuration (PCI_EXP_LNKCTL2)
could lead to link training issues or incorrect PCIe state during local
initialization or hotplug paths.

> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index 40d5ef3e347e4..f4b27a77a89df 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
[ ... ]
> @@ -1169,6 +1095,79 @@ static int rzg3s_pcie_set_max_link_speed(struct rzg3s_pcie_host *host)
>  	return ret;
>  }
>  
> +static void rzg3s_pcie_teardown_intx(struct rzg3s_pcie_host *host, int count)
> +{
> +	if (host->intx_domain)
> +		irq_domain_remove(host->intx_domain);

[Severity: High]
Does this inverted teardown order introduce a use-after-free risk?

By calling irq_domain_remove() before unchaining the interrupt handlers,
host->intx_domain is freed early. If an INTx interrupt fires in this window,
rzg3s_pcie_intx_irq_handler() will be executed and dereference the freed
host->intx_domain.

Can we safely destroy the IRQ domain after unchaining the interrupt handlers?

> +
> +	while (--count >= 0) {
> +		irq_set_chained_handler_and_data(host->intx_irqs[count], NULL,
> +						 NULL);
> +	}
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922144629.586997-1-claudiu.beznea@kernel.org?part=6

  reply	other threads:[~2026-09-22 14:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 14:46 [PATCH v4 0/8] PCI: rzg3s-host: Add PCIe hotplug support Claudiu Beznea
2026-09-22 14:46 ` [PATCH v4 1/8] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order Claudiu Beznea
2026-09-22 14:58   ` sashiko-bot
2026-09-24 12:19   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 2/8] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
2026-09-22 14:53   ` sashiko-bot
2026-09-24 12:21   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 3/8] PCI: rzg3s-host: Drop nop instructions Claudiu Beznea
2026-09-22 14:54   ` sashiko-bot
2026-09-24 12:21   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 4/8] PCI: rzg3s-host: Move host configuration code together Claudiu Beznea
2026-09-22 14:56   ` sashiko-bot
2026-09-24 12:22   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 5/8] PCI: rzg3s-host: Move suspend/resume code into dedicated functions Claudiu Beznea
2026-09-22 14:53   ` sashiko-bot
2026-09-24 12:23   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 6/8] PCI: rzg3s-host: Move IRQ domain setup code Claudiu Beznea
2026-09-22 14:58   ` sashiko-bot [this message]
2026-09-24 12:25   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 7/8] PCI: rzg3s-host: Re-enumerate the bus on PCIe link-state changes Claudiu Beznea
2026-09-22 15:05   ` sashiko-bot
2026-09-24 12:26   ` Lad, Prabhakar
2026-09-22 14:46 ` [PATCH v4 8/8] PCI: rzg3s-host: Add bridge::reset_root_port() Claudiu Beznea
2026-09-22 15:05   ` sashiko-bot
2026-09-24 12:30   ` Lad, Prabhakar

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=20260922145842.DA3C61F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=claudiu.beznea@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --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