* [PATCH] usb: hcd-pci: avoid double disable on surprise removal
@ 2026-10-20 15:05 Konrad Dybcio
2026-10-20 19:52 ` Alan Stern
0 siblings, 1 reply; 3+ messages in thread
From: Konrad Dybcio @ 2026-10-20 15:05 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Konrad Dybcio
A PCI HCD can be surprise-removed after suspend_common() disables it
and before resume_common() re-enables it. Avoid a second call to
pci_disable_device() in the remove path when no enable reference
remains.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/usb/core/hcd-pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index cd223475917ef199511311eda5c6aaef073b0ad4..34c4d352b40c40c54cf17c30fc264833ba05bcd6 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -348,7 +348,9 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
usb_put_hcd(hcd);
if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
pci_free_irq_vectors(dev);
- pci_disable_device(dev);
+
+ if (pci_is_enabled(dev))
+ pci_disable_device(dev);
}
EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
---
base-commit: f5f84daefcd92d7a630066635ecea1433ed5eac7
change-id: 20261020-topic-hub_pci-903b8c18d17b
Best regards,
--
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: hcd-pci: avoid double disable on surprise removal
2026-10-20 15:05 [PATCH] usb: hcd-pci: avoid double disable on surprise removal Konrad Dybcio
@ 2026-10-20 19:52 ` Alan Stern
2026-10-20 19:55 ` Alan Stern
0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2026-10-20 19:52 UTC (permalink / raw)
To: Konrad Dybcio; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Tue, Oct 20, 2026 at 05:05:39PM +0200, Konrad Dybcio wrote:
> A PCI HCD can be surprise-removed after suspend_common() disables it
> and before resume_common() re-enables it. Avoid a second call to
> pci_disable_device() in the remove path when no enable reference
> remains.
Does the double disable actually cause any problems?
Alan Stern
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/usb/core/hcd-pci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
> index cd223475917ef199511311eda5c6aaef073b0ad4..34c4d352b40c40c54cf17c30fc264833ba05bcd6 100644
> --- a/drivers/usb/core/hcd-pci.c
> +++ b/drivers/usb/core/hcd-pci.c
> @@ -348,7 +348,9 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
> usb_put_hcd(hcd);
> if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
> pci_free_irq_vectors(dev);
> - pci_disable_device(dev);
> +
> + if (pci_is_enabled(dev))
> + pci_disable_device(dev);
> }
> EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
>
>
> ---
> base-commit: f5f84daefcd92d7a630066635ecea1433ed5eac7
> change-id: 20261020-topic-hub_pci-903b8c18d17b
>
> Best regards,
> --
> Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: hcd-pci: avoid double disable on surprise removal
2026-10-20 19:52 ` Alan Stern
@ 2026-10-20 19:55 ` Alan Stern
0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2026-10-20 19:55 UTC (permalink / raw)
To: Konrad Dybcio; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Tue, Oct 20, 2026 at 03:52:28PM -0400, Alan Stern wrote:
> On Tue, Oct 20, 2026 at 05:05:39PM +0200, Konrad Dybcio wrote:
> > A PCI HCD can be surprise-removed after suspend_common() disables it
> > and before resume_common() re-enables it. Avoid a second call to
> > pci_disable_device() in the remove path when no enable reference
> > remains.
>
> Does the double disable actually cause any problems?
Also, is your patch any different from this one from two days ago?
https://lore.kernel.org/linux-usb/20261018164134.134106-1-cole@unwrap.rs/
Alan Stern
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-20 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 15:05 [PATCH] usb: hcd-pci: avoid double disable on surprise removal Konrad Dybcio
2026-10-20 19:52 ` Alan Stern
2026-10-20 19:55 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®