[PATCH] usb: cdns3: cdnsp-pci: Fix PCI function reference leak in cdnsp_pci_probe()
From: Wentao Liang
Date: Thu Sep 17 2026 - 12:35:42 EST
cdnsp_get_second_fun() returns a device obtained with pci_get_device(),
which takes a reference to it. The error paths release it through the
put_pci label, but the successful return does not, so the reference is
leaked for every successfully probed device.
Release it on the success path too.
Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/usb/cdns3/cdnsp-pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/cdns3/cdnsp-pci.c b/drivers/usb/cdns3/cdnsp-pci.c
index 566d94e49102..061a2c43e986 100644
--- a/drivers/usb/cdns3/cdnsp-pci.c
+++ b/drivers/usb/cdns3/cdnsp-pci.c
@@ -162,6 +162,8 @@ static int cdnsp_pci_probe(struct pci_dev *pdev,
if (pci_dev_run_wake(pdev))
pm_runtime_put_noidle(&pdev->dev);
+ pci_dev_put(func);
+
return 0;
free_cdnsp:
--
2.34.1