From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, "Łukasz Bartosik" <ukaszb@chromium.org>,
"Mathias Nyman" <mathias.nyman@linux.intel.com>,
"Alan Stern" <stern@rowland.harvard.edu>
Subject: [PATCH 6.6 100/111] usb: hub: Dont try to recover devices lost during warm reset.
Date: Tue, 22 Jul 2025 15:45:15 +0200 [thread overview]
Message-ID: <20250722134337.141743355@linuxfoundation.org> (raw)
In-Reply-To: <20250722134333.375479548@linuxfoundation.org>
6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <mathias.nyman@linux.intel.com>
commit 2521106fc732b0b75fd3555c689b1ed1d29d273c upstream.
Hub driver warm-resets ports in SS.Inactive or Compliance mode to
recover a possible connected device. The port reset code correctly
detects if a connection is lost during reset, but hub driver
port_event() fails to take this into account in some cases.
port_event() ends up using stale values and assumes there is a
connected device, and will try all means to recover it, including
power-cycling the port.
Details:
This case was triggered when xHC host was suspended with DbC (Debug
Capability) enabled and connected. DbC turns one xHC port into a simple
usb debug device, allowing debugging a system with an A-to-A USB debug
cable.
xhci DbC code disables DbC when xHC is system suspended to D3, and
enables it back during resume.
We essentially end up with two hosts connected to each other during
suspend, and, for a short while during resume, until DbC is enabled back.
The suspended xHC host notices some activity on the roothub port, but
can't train the link due to being suspended, so xHC hardware sets a CAS
(Cold Attach Status) flag for this port to inform xhci host driver that
the port needs to be warm reset once xHC resumes.
CAS is xHCI specific, and not part of USB specification, so xhci driver
tells usb core that the port has a connection and link is in compliance
mode. Recovery from complinace mode is similar to CAS recovery.
xhci CAS driver support that fakes a compliance mode connection was added
in commit 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
Once xHCI resumes and DbC is enabled back, all activity on the xHC
roothub host side port disappears. The hub driver will anyway think
port has a connection and link is in compliance mode, and hub driver
will try to recover it.
The port power-cycle during recovery seems to cause issues to the active
DbC connection.
Fix this by clearing connect_change flag if hub_port_reset() returns
-ENOTCONN, thus avoiding the whole unnecessary port recovery and
initialization attempt.
Cc: stable@vger.kernel.org
Fixes: 8bea2bd37df0 ("usb: Add support for root hub port status CAS")
Tested-by: Łukasz Bartosik <ukaszb@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20250623133947.3144608-1-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/core/hub.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5714,6 +5714,7 @@ static void port_event(struct usb_hub *h
struct usb_device *hdev = hub->hdev;
u16 portstatus, portchange;
int i = 0;
+ int err;
connect_change = test_bit(port1, hub->change_bits);
clear_bit(port1, hub->event_bits);
@@ -5810,8 +5811,11 @@ static void port_event(struct usb_hub *h
} else if (!udev || !(portstatus & USB_PORT_STAT_CONNECTION)
|| udev->state == USB_STATE_NOTATTACHED) {
dev_dbg(&port_dev->dev, "do warm reset, port only\n");
- if (hub_port_reset(hub, port1, NULL,
- HUB_BH_RESET_TIME, true) < 0)
+ err = hub_port_reset(hub, port1, NULL,
+ HUB_BH_RESET_TIME, true);
+ if (!udev && err == -ENOTCONN)
+ connect_change = 0;
+ else if (err < 0)
hub_port_disable(hub, port1, 1);
} else {
dev_dbg(&port_dev->dev, "do warm reset, full device\n");
next prev parent reply other threads:[~2025-07-22 13:55 UTC|newest]
Thread overview: 128+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 13:43 [PATCH 6.6 000/111] 6.6.100-rc1 review Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 001/111] phy: tegra: xusb: Fix unbalanced regulator disable in UTMI PHY mode Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 002/111] phy: tegra: xusb: Decouple CYA_TRK_CODE_UPDATE_ON_IDLE from trk_hw_mode Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 003/111] phy: tegra: xusb: Disable periodic tracking on Tegra234 Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 004/111] USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 005/111] USB: serial: option: add Foxconn T99W640 Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 006/111] USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 007/111] usb: musb: fix gadget state on disconnect Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 008/111] usb: gadget: configfs: Fix OOB read on empty string write Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 009/111] i2c: stm32: fix the device used for the DMA map Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 010/111] thunderbolt: Fix wake on connect at runtime Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 011/111] thunderbolt: Fix bit masking in tb_dp_port_set_hops() Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 012/111] nvmem: imx-ocotp: fix MAC address byte length Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 013/111] Input: xpad - set correct controller type for Acer NGR200 Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 014/111] pch_uart: Fix dma_sync_sg_for_device() nents value Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 015/111] spi: Add check for 8-bit transfer with 8 IO mode support Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 016/111] dm-bufio: fix sched in atomic context Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 017/111] HID: core: ensure the allocated report buffer can contain the reserved report ID Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 018/111] HID: core: ensure __hid_request reserves the report ID as the first byte Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 019/111] HID: core: do not bypass hid_hw_raw_request Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 020/111] tracing/probes: Avoid using params uninitialized in parse_btf_arg() Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 021/111] tracing: Add down_write(trace_event_sem) when adding trace event Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 022/111] tracing/osnoise: Fix crash in timerlat_dump_stack() Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 023/111] drm/amdgpu/gfx8: reset compute ring wptr on the GPU on resume Greg Kroah-Hartman
2025-07-22 13:43 ` [PATCH 6.6 024/111] ALSA: hda/realtek: Add quirk for ASUS ROG Strix G712LWS Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 025/111] io_uring/poll: fix POLLERR handling Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 026/111] phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 027/111] net/mlx5: Update the list of the PCI supported devices Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 028/111] arm64: dts: imx8mp-venice-gw74xx: fix TPM SPI frequency Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 029/111] arm64: dts: freescale: imx8mm-verdin: Keep LDO5 always on Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 030/111] arm64: dts: rockchip: use cs-gpios for spi1 on ringneck Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 031/111] af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 032/111] af_packet: fix soft lockup issue caused by tpacket_snd() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 033/111] dmaengine: nbpfaxi: Fix memory corruption in probe() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 034/111] isofs: Verify inode mode when loading from disk Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 035/111] memstick: core: Zero initialize id_reg in h_memstick_read_dev_id() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 036/111] mmc: bcm2835: Fix dma_unmap_sg() nents value Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 037/111] mmc: sdhci-pci: Quirk for broken command queuing on Intel GLK-based Positivo models Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 038/111] mmc: sdhci_am654: Workaround for Errata i2312 Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 039/111] net: libwx: remove duplicate page_pool_put_full_page() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 040/111] net: libwx: fix the using of Rx buffer DMA Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 041/111] net: libwx: properly reset Rx ring descriptor Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 042/111] pmdomain: governor: Consider CPU latency tolerance from pm_domain_cpu_gov Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 043/111] s390/bpf: Fix bpf_arch_text_poke() with new_addr == NULL again Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 044/111] smb: client: fix use-after-free in crypt_message when using async crypto Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 045/111] soc: aspeed: lpc-snoop: Cleanup resources in stack-order Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 046/111] soc: aspeed: lpc-snoop: Dont disable channels that arent enabled Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 047/111] iio: accel: fxls8962af: Fix use after free in fxls8962af_fifo_flush Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 048/111] iio: adc: max1363: Fix MAX1363_4X_CHANS/MAX1363_8X_CHANS[] Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 049/111] iio: adc: max1363: Reorder mode_list[] entries Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 050/111] iio: adc: stm32-adc: Fix race in installing chained IRQ handler Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 051/111] comedi: pcl812: Fix bit shift out of bounds Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 052/111] comedi: aio_iiro_16: " Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 053/111] comedi: das16m1: " Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 054/111] comedi: das6402: " Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 055/111] comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 056/111] comedi: Fix some signed shift left operations Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 057/111] comedi: Fix use of uninitialized data in insn_rw_emulate_bits() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 058/111] comedi: Fix initialization of data for instructions that write to subdevice Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 059/111] soundwire: amd: fix for handling slave alerts after link is down Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 060/111] soundwire: amd: fix for clearing command status register Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 061/111] bpf: Reject %p% format string in bprintf-like helpers Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 062/111] cachefiles: Fix the incorrect return value in __cachefiles_write() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 063/111] net: emaclite: Fix missing pointer increment in aligned_read() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 064/111] block: fix kobject leak in blk_unregister_queue Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 065/111] net/sched: sch_qfq: Fix race condition on qfq_aggregate Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 066/111] rpl: Fix use-after-free in rpl_do_srh_inline() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 067/111] smb: client: fix use-after-free in cifs_oplock_break Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 068/111] nvme: fix inconsistent RCU list manipulation in nvme_ns_add_to_ctrl_list() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 069/111] net: phy: Dont register LEDs for genphy Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 070/111] nvme: fix misaccounting of nvme-mpath inflight I/O Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 071/111] wifi: cfg80211: remove scan request n_channels counted_by Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 072/111] selftests: net: increase inter-packet timeout in udpgro.sh Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 073/111] hwmon: (corsair-cpro) Validate the size of the received input buffer Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 074/111] ice: add NULL check in eswitch lag check Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 075/111] usb: net: sierra: check for no status endpoint Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 076/111] Bluetooth: Fix null-ptr-deref in l2cap_sock_resume_cb() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 077/111] Bluetooth: hci_sync: fix connectable extended advertising when using static random address Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 078/111] Bluetooth: SMP: If an unallowed command is received consider it a failure Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 079/111] Bluetooth: SMP: Fix using HCI_ERROR_REMOTE_USER_TERM on timeout Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 080/111] Bluetooth: btusb: QCA: Fix downloading wrong NVM for WCN6855 GF variant without board ID Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 081/111] net/mlx5: Correctly set gso_size when LRO is used Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 082/111] ipv6: mcast: Delay put pmc->idev in mld_del_delrec() Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 083/111] netfilter: nf_conntrack: fix crash due to removal of uninitialised entry Greg Kroah-Hartman
2025-07-22 13:44 ` [PATCH 6.6 084/111] Bluetooth: L2CAP: Fix attempting to adjust outgoing MTU Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 085/111] hv_netvsc: Set VF priv_flags to IFF_NO_ADDRCONF before open to prevent IPv6 addrconf Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 086/111] tls: always refresh the queue when reading sock Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 087/111] net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 088/111] net: bridge: Do not offload IGMP/MLD messages Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 089/111] net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 090/111] rxrpc: Fix recv-recv race of completed call Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 091/111] rxrpc: Fix transmission of an abort in response to an abort Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 092/111] Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 093/111] sched: Change nr_uninterruptible type to unsigned long Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 094/111] ipv6: make addrconf_wq single threaded Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 095/111] clone_private_mnt(): make sure that caller has CAP_SYS_ADMIN in the right userns Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 096/111] arm64: Filter out SME hwcaps when FEAT_SME isnt implemented Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 097/111] usb: hub: fix detection of high tier USB3 devices behind suspended hubs Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 098/111] usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 099/111] usb: hub: Fix flushing of delayed work used for post resume purposes Greg Kroah-Hartman
2025-07-22 13:45 ` Greg Kroah-Hartman [this message]
2025-07-22 13:45 ` [PATCH 6.6 101/111] usb: dwc3: qcom: Dont leave BCR asserted Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 102/111] i2c: omap: Add support for setting mux Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 103/111] i2c: omap: Fix an error handling path in omap_i2c_probe() Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 104/111] i2c: omap: Handle omap_i2c_init() errors " Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 105/111] regulator: pwm-regulator: Calculate the output voltage for disabled PWMs Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 106/111] regulator: pwm-regulator: Manage boot-on with disabled PWM channels Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 107/111] ASoC: fsl_sai: Force a software reset when starting in consumer mode Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 108/111] Revert "selftests/bpf: adjust dummy_st_ops_success to detect additional error" Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 109/111] Revert "selftests/bpf: dummy_st_ops should reject 0 for non-nullable params" Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 110/111] i2c: omap: fix deprecated of_property_read_bool() use Greg Kroah-Hartman
2025-07-22 13:45 ` [PATCH 6.6 111/111] nvmem: layouts: u-boot-env: remove crc32 endianness conversion Greg Kroah-Hartman
2025-07-22 16:29 ` [PATCH 6.6 000/111] 6.6.100-rc1 review Brett A C Sheffield
2025-07-23 6:33 ` [PATCH 6.6 111/111] nvmem: layouts: u-boot-env: remove crc32 endianness conversion Michael Pratt
2025-07-23 6:41 ` Greg Kroah-Hartman
2025-07-23 10:54 ` Michael Pratt
2025-07-23 11:38 ` Greg Kroah-Hartman
2025-07-22 18:58 ` [PATCH 6.6 000/111] 6.6.100-rc1 review Florian Fainelli
2025-07-22 21:24 ` Shuah Khan
2025-07-22 22:13 ` Miguel Ojeda
2025-07-23 6:09 ` Peter Schneider
2025-07-23 11:02 ` Mark Brown
2025-07-23 11:34 ` Harshit Mogalapalli
2025-07-23 11:34 ` Jon Hunter
2025-07-23 13:15 ` Naresh Kamboju
2025-07-24 3:46 ` Hardik Garg
2025-07-24 3:48 ` Ron Economos
2025-07-30 16:59 ` 6.6.101-rc1-g1a25720a319a review Brett A C Sheffield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722134337.141743355@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=mathias.nyman@linux.intel.com \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=ukaszb@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).