[PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers
From: Claudiu Beznea
Date: Mon Oct 19 2026 - 02:52:15 EST
From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
rzg3s_pcie_init_irqdomain() installs the chained INTx handlers before
creating the INTx IRQ domain. irq_set_chained_handler_and_data() also
enables the interrupt, so an INTx interrupt arriving in between is
handled by rzg3s_pcie_intx_irq_handler() while host->intx_domain is
still NULL, leading to a NULL pointer dereference.
Move the IRQ domain creation before the loop that installs the chained
handlers.
Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---
Changes in v7:
- none, this patch is new
drivers/pci/controller/pcie-rzg3s-host.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index bee3e46d025f..cc985020d962 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1024,6 +1024,16 @@ static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host)
struct platform_device *pdev = to_platform_device(dev);
int i, ret;
+ host->intx_domain = irq_domain_create_linear(dev_fwnode(dev),
+ PCI_NUM_INTX,
+ &rzg3s_pcie_intx_domain_ops,
+ host);
+ if (!host->intx_domain) {
+ return dev_err_probe(dev, -EINVAL,
+ "Failed to add irq domain for INTx IRQs\n");
+ }
+ irq_domain_update_bus_token(host->intx_domain, DOMAIN_BUS_WIRED);
+
for (i = 0; i < PCI_NUM_INTX; i++) {
char irq_name[5] = {0};
int irq;
@@ -1045,18 +1055,6 @@ static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host)
host);
}
- host->intx_domain = irq_domain_create_linear(dev_fwnode(dev),
- PCI_NUM_INTX,
- &rzg3s_pcie_intx_domain_ops,
- host);
- if (!host->intx_domain) {
- ret = -EINVAL;
- dev_err_probe(dev, ret,
- "Failed to add irq domain for INTx IRQs\n");
- goto teardown_intx;
- }
- irq_domain_update_bus_token(host->intx_domain, DOMAIN_BUS_WIRED);
-
if (IS_ENABLED(CONFIG_PCI_MSI)) {
ret = rzg3s_pcie_init_msi(host);
--
2.43.0