* [PATCH] perf/dwc_pcie: Fix PCI device reference leak in dwc_pcie_pmu_probe()
@ 2026-09-17 13:32 Wentao Liang
2026-09-17 13:42 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 13:32 UTC (permalink / raw)
To: cuiyunhui
Cc: linux-arm-kernel, linux-kernel, linux-perf-users, mark.rutland,
renyu.zj, will, xueshuai, Wentao Liang, stable
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@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-17 13:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 13:32 [PATCH] perf/dwc_pcie: Fix PCI device reference leak in dwc_pcie_pmu_probe() Wentao Liang
2026-09-17 13:42 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox