[PATCH] perf/dwc_pcie: Fix PCI device reference leak in dwc_pcie_pmu_probe()

Wentao Liang vulab at iscas.ac.cn
Thu Sep 17 06:32:41 PDT 2026


dwc_pcie_pmu_probe() gets a reference to the PCI device with
pci_get_domain_bus_and_slot(), but returns -ENODEV directly when
dwc_pcie_des_cap() does not find the RAS DES capability, leaking the
reference.  The other early returns and the success path drop it.

Release the reference on that path as well.

Fixes: 7f35b429802a ("perf/dwc_pcie: fix duplicate pci_dev devices")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/perf/dwc_pcie_pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c
index 5385401fa9cf..edaf5d2e0daa 100644
--- a/drivers/perf/dwc_pcie_pmu.c
+++ b/drivers/perf/dwc_pcie_pmu.c
@@ -710,8 +710,10 @@ static int dwc_pcie_pmu_probe(struct platform_device *plat_dev)
 	}
 
 	vsec = dwc_pcie_des_cap(pdev);
-	if (!vsec)
+	if (!vsec) {
+		pci_dev_put(pdev);
 		return -ENODEV;
+	}
 
 	pci_dev_put(pdev);
 	name = devm_kasprintf(&plat_dev->dev, GFP_KERNEL, "dwc_rootport_%x", sbdf);
-- 
2.34.1




More information about the linux-arm-kernel mailing list