From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2BC2267F57; Tue, 8 Apr 2025 12:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116289; cv=none; b=e8Gyd8BwIGq3hnt/hpvS+ejdDb7SN6rH2E56OmY8FsWqZdnTIPQz2QcMRmDuXI8LSM7dw7ZmIvtoJrs+5qmnxzOxdZ1aYu65de6ItmZVGKFP1KywWWExjdGeXNWBn22Xm0oruD4GFPtu1HsDVm+e1oPeFun29CE0TDVsdsjcjio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116289; c=relaxed/simple; bh=iEv6Qsaj2sMPJkTFkKHo8Tu5BnWf6F+HVS+KbODGX08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HO9RiWmQb26yFG6KO6NQr1WFi+odJ48LKaIuLtbGWUAiL4ETcb/WGGMAf1dCUY67gXjJnEJ02G0F8XcoV6t7dTIZ4URncl5XRR/jmLWt01ZDg0t1b+qWB+NqoM35Ct28HrJrQqHVC0w9VnpgIr0AjMRyvOIptMglRvz8BvPIDCY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KMcQfvZf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KMcQfvZf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D063CC4CEE5; Tue, 8 Apr 2025 12:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744116289; bh=iEv6Qsaj2sMPJkTFkKHo8Tu5BnWf6F+HVS+KbODGX08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMcQfvZf8iRv2M4sgS3QOqHVceRmTOLlhsocRtlr745mGDjnYtuvRQlvon40fW/2U eZtfRPbpyhQRf4VJWRWI6LTfNJNeBBW0U37bINso8ruAVNqOKydXNLlKteY5LG6fP8 KwEbsaAILlSEKnaI0t27XqmtyZzyBcfTTcSJzD5c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Thippeswamy Havalige , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Sasha Levin Subject: [PATCH 6.12 084/423] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Date: Tue, 8 Apr 2025 12:46:50 +0200 Message-ID: <20250408104847.699159473@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104845.675475678@linuxfoundation.org> References: <20250408104845.675475678@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thippeswamy Havalige [ Upstream commit 57b0302240741e73fe51f88404b3866e0d2933ad ] The IRQ domain allocated for the PCIe controller is not freed if resource_list_first_type() returns NULL, leading to a resource leak. This fix ensures properly cleaning up the allocated IRQ domain in the error path. Fixes: 49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'") Signed-off-by: Thippeswamy Havalige [kwilczynski: added missing Fixes: tag, refactored to use one of the goto labels] Signed-off-by: Krzysztof WilczyƄski Link: https://lore.kernel.org/r/20250224155025.782179-2-thippeswamy.havalige@amd.com Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-xilinx-cpm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c index a0f5e1d67b04c..1594d9e9e637a 100644 --- a/drivers/pci/controller/pcie-xilinx-cpm.c +++ b/drivers/pci/controller/pcie-xilinx-cpm.c @@ -570,15 +570,17 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) return err; bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); - if (!bus) - return -ENODEV; + if (!bus) { + err = -ENODEV; + goto err_free_irq_domains; + } port->variant = of_device_get_match_data(dev); err = xilinx_cpm_pcie_parse_dt(port, bus->res); if (err) { dev_err(dev, "Parsing DT failed\n"); - goto err_parse_dt; + goto err_free_irq_domains; } xilinx_cpm_pcie_init_port(port); @@ -602,7 +604,7 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) xilinx_cpm_free_interrupts(port); err_setup_irq: pci_ecam_free(port->cfg); -err_parse_dt: +err_free_irq_domains: xilinx_cpm_free_irq_domains(port); return err; } -- 2.39.5