Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290364; b=0+p+shoZrHbfJcRiK8D6PCQx4YihTU5yyrY1686svYI60m2B43Q5BRX+/WiRahSWCU9l Oki7gncT7HmkR9Wz/vHwMtfYV0fCSriSsZdIRDCep+8aMIZBEinP4O8WCUI7yPWFEpPr9 w7bAKtShMWo+b/nRp7CTrnkleHAXSHNI3FBo16g8sFYpgp0AcVOFUGh0/1lnFX7itPvaH oVCXXmZXsiMUVIa70K5vqR0DUZD94KuVNMaRxoQ+pbEQ0rgH4RiMNn1V7J4rosOzTQpyd KsrhK6wjc50rnusBTbyRDF3kRSS/8txpgUfnQbv7eUUPYvnPTWcMLBOCyTYoP6stONg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290364; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=UJc0JWE204nZKYXEF+rPrTwEWG28TCfCmlgT2fGhOk8=; b=eeZoR5hDqcBdaaCRzLFii1DrwQrvEk4AZVAyU7jFMSMcp6XaOJpRWfMS/9LLv28PCT4A Gt0KzH6a+PSxVW4Xj7HAxeWSFmOvT3d/JMZczh8u4Cgm2AJvhL5SUfZSpFQDVxGXXnsXW 0m27Z1CJOl+DXxHb1mXpmYOZLBlGv+5WOzcwETS7J3iZyRVLSpo1DE97I0VnXjAl/0rNG LmNxrMzW0YlnPeh9bS298+x6qREpLIIJmm22ZgxZyjoBw5wllHQEPkOw51HGIQByty4eN CZiVhvPWReEi6C/Q3L1ExJNPZD7jI8NjikxhBJ5xvclIH4EkrtXnawMDpYllAUJG+Fg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BlpLPj9t; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F9D4606A685; Thu, 3 Dec 2026 09:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BlpLPj9t Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEE081F00893; Thu, 3 Dec 2026 09:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290363; bh=UJc0JWE204nZKYXEF+rPrTwEWG28TCfCmlgT2fGhOk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BlpLPj9twdm/PUM+vKn3M+E9IijRMGEZrfh7zWpunM/BN0iyr7UKts4wN4GsjkGea 5LvsLiOBSopxCQDLD914OT7Fn1OiBklOVWofgHxyn6L82KDiiuKuS4FnYMWBENfHOG x09i/Bq4R2A6zq2XLfncF6CpaHOYTGpQlERMfySdMeuMXWsmhohMJhrscyOKE3+jx2 MKegAZkuqnA4lHl0XdJnw+yJDULB+DbSLmAEFgqIp26ZO6eaFPOwWpGcrE64uag2De /cVXur0FCY9AtF0N1mk7IEBsjLDWSG5gaYfuw2FyHVwbRRILMXd7EmZnSfegrohEGx lTrZ+hPvZWpew== From: Claudiu Beznea To: lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, bhelgaas@google.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Claudiu Beznea , stable@vger.kernel.org, Wolfram Sang Subject: [PATCH 3/6] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Date: Thu, 3 Dec 2026 11:32:21 +0200 Message-ID: <20261203093224.247349-4-claudiu.beznea@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261203093224.247349-1-claudiu.beznea@kernel.org> References: <20261203093224.247349-1-claudiu.beznea@kernel.org> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea rzg3s_pcie_init_irqdomain() installs the chained INTx handlers before creating the INTx IRQ domain. Since irq_set_chained_handler_and_data() also enables the interrupt, an INTx interrupt arriving in between is handled by rzg3s_pcie_intx_irq_handler() while host->intx_domain is still NULL, which could lead to a NULL pointer dereference. This was identified by code inspection. 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@vger.kernel.org Tested-by: Wolfram Sang Signed-off-by: Claudiu Beznea --- Changes since [1]: - collected tags - adjusted the patch description as suggested in the review process [1] https://lore.kernel.org/all/20261019065025.2146539-1-claudiu.beznea@kernel.org 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 66a5adf9db7e..201888f1f525 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