The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1] USB: pci-quirks: Release EHCI device reference
@ 2026-08-07  2:43 Yuho Choi
  2026-08-07 16:21 ` Alan Stern
  0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-08-07  2:43 UTC (permalink / raw)
  To: mathias.nyman, gregkh; +Cc: linux-usb, linux-kernel, Yuho Choi

for_each_pci_dev() holds a reference to the current device.  The Intel
EHCI lookup breaks as soon as it finds a match, so the iterator does not
get a chance to drop that reference on its next iteration.

Release the reference before leaving the loop.

Fixes: 26b76798e050 ("Intel xhci: refactor EHCI/xHCI port switching")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
 drivers/usb/host/pci-quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 0404489c2f6a..ba158d63bb8b 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -1073,6 +1073,7 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev)
 		if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
 		    companion->vendor == PCI_VENDOR_ID_INTEL) {
 			ehci_found = true;
+			pci_dev_put(companion);
 			break;
 		}
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] USB: pci-quirks: Release EHCI device reference
  2026-08-07  2:43 [PATCH v1] USB: pci-quirks: Release EHCI device reference Yuho Choi
@ 2026-08-07 16:21 ` Alan Stern
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2026-08-07 16:21 UTC (permalink / raw)
  To: Yuho Choi; +Cc: mathias.nyman, gregkh, linux-usb, linux-kernel

On Thu, Aug 06, 2026 at 10:43:04PM -0400, Yuho Choi wrote:
> for_each_pci_dev() holds a reference to the current device.  The Intel
> EHCI lookup breaks as soon as it finds a match, so the iterator does not
> get a chance to drop that reference on its next iteration.
> 
> Release the reference before leaving the loop.
> 
> Fixes: 26b76798e050 ("Intel xhci: refactor EHCI/xHCI port switching")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>

>  drivers/usb/host/pci-quirks.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index 0404489c2f6a..ba158d63bb8b 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -1073,6 +1073,7 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev)
>  		if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
>  		    companion->vendor == PCI_VENDOR_ID_INTEL) {
>  			ehci_found = true;
> +			pci_dev_put(companion);
>  			break;
>  		}
>  	}
> -- 
> 2.43.0
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-07 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07  2:43 [PATCH v1] USB: pci-quirks: Release EHCI device reference Yuho Choi
2026-08-07 16:21 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox