* [PATCH] usb: cdns3: Fix PCI function reference leak in cdns3_pci_remove()
@ 2026-09-17 16:06 Wentao Liang
2026-10-09 1:44 ` Peter Chen (Qualcomm)
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 16:06 UTC (permalink / raw)
To: felipe.balbi
Cc: gregkh, linux-kernel, linux-usb, pawell, peter.chen, rogerq,
Wentao Liang, stable
cdns3_get_second_fun() returns a device obtained with pci_get_device(),
which takes a reference to it. cdns3_pci_remove() uses the device only
to check whether the second function is enabled and then returns without
dropping the reference.
Release it before returning.
Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/usb/cdns3/cdns3-pci-wrap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/cdns3/cdns3-pci-wrap.c b/drivers/usb/cdns3/cdns3-pci-wrap.c
index 1ad722e7704d..6639751ab22f 100644
--- a/drivers/usb/cdns3/cdns3-pci-wrap.c
+++ b/drivers/usb/cdns3/cdns3-pci-wrap.c
@@ -188,6 +188,8 @@ static void cdns3_pci_remove(struct pci_dev *pdev)
if (!pci_is_enabled(func))
kfree(wrap);
+
+ pci_dev_put(func);
}
static const struct pci_device_id cdns3_pci_ids[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb: cdns3: Fix PCI function reference leak in cdns3_pci_remove()
2026-09-17 16:06 [PATCH] usb: cdns3: Fix PCI function reference leak in cdns3_pci_remove() Wentao Liang
@ 2026-10-09 1:44 ` Peter Chen (Qualcomm)
0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen (Qualcomm) @ 2026-10-09 1:44 UTC (permalink / raw)
To: Wentao Liang
Cc: felipe.balbi, gregkh, linux-kernel, linux-usb, pawell, rogerq,
stable
On 26-09-17 16:06:22, Wentao Liang wrote:
> cdns3_get_second_fun() returns a device obtained with pci_get_device(),
> which takes a reference to it. cdns3_pci_remove() uses the device only
> to check whether the second function is enabled and then returns without
> dropping the reference.
>
> Release it before returning.
>
> Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Acked-by: Peter Chen <peter.chen@kernel.org>
Peter
> ---
> drivers/usb/cdns3/cdns3-pci-wrap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/cdns3/cdns3-pci-wrap.c b/drivers/usb/cdns3/cdns3-pci-wrap.c
> index 1ad722e7704d..6639751ab22f 100644
> --- a/drivers/usb/cdns3/cdns3-pci-wrap.c
> +++ b/drivers/usb/cdns3/cdns3-pci-wrap.c
> @@ -188,6 +188,8 @@ static void cdns3_pci_remove(struct pci_dev *pdev)
>
> if (!pci_is_enabled(func))
> kfree(wrap);
> +
> + pci_dev_put(func);
> }
>
> static const struct pci_device_id cdns3_pci_ids[] = {
> --
> 2.34.1
>
--
Thanks,
Peter Chen
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-09 1:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 16:06 [PATCH] usb: cdns3: Fix PCI function reference leak in cdns3_pci_remove() Wentao Liang
2026-10-09 1:44 ` Peter Chen (Qualcomm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox