From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379912; b=ofahaszoC1Q/hYqQg7joEQA51ESPwW78979VMn4Bdms3ruxXezL13IlwvlhKmw+silz6 reNZY0zMdLqDfYnpdA3u9UMzb40o/7Gw1s5y/B+9sSlQjbaZ4JHWjJGZRPJMO4VLXUUF7 DDCU4h0sljfSZEqxb9WZ1mSUy+jfujLSJbezKk0TSAtdPcLVtjxhTy3tmpe1AJCS9B36b Ibp73WMJIgc0lYk7RmKWLe+G5+KADpuvcKi+53+Bbj1vftFFYrK5SMF7968obXuyWF19F lzML4rynXZ4sFQ30aCLlObUIgDZ15Zkvxb0lVCji0aCpKuqEJHFKR8+yunR00CAq+3Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379912; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=+CaMLz583y8OSsSSt67Yb5ZFyPDQhp3YrDR52yKe7ZM=; b=v16QnFuPHnXbn0J1FuGgCjrJ2lFH2+xfE2iSuYjO+neGhu1IU/HSVdpeh5gcs8GBQbuh QvNY6twbCMXr4xoTx229n9fm9Dz6Z+mjrvpfslGpFdbK/dWx7G72niILNkhfNku/WYQZi IsvTvALgASKYrlsorUQNohQJYTcPCBjhEfsP8eel+VCMxSo6jWJDE2LZQI23na5jhfuKt pM2e7wqU3LS8l4qUfoL5yOQrhmYZsHMslG0iyWaBNR2RN89ddJMX5pAHx5pw/3qG0FctL o9iHDOKhDzu3rmdsKnhzEfwkHMAG51v9QZ6+UJ/H0WFGFqPV+uCHquBpRcA+y3Vdftw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="j/FPHU5b"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DED9E606A322; Fri, 4 Dec 2026 10:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j/FPHU5b Received: by smtp.kernel.org (Postfix) with ESMTPSA id 205F71F000CE; Fri, 4 Dec 2026 10:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379912; bh=+CaMLz583y8OSsSSt67Yb5ZFyPDQhp3YrDR52yKe7ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j/FPHU5bL9AEgN9ZVXYEeugbohDVJqy5jcAm4uhs+UMw75jukmlfJ0JAhFrOQmDfz 3Z316HQwAcporiXifN5NmeyUnqF80VydDG10PAQov77NWTX1qlVFWjnceZZwOwSWgy UF9XKbW3el3JguTNlvEcDGOfBghdKdOd+oqPEUIQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Mathias Nyman , Sasha Levin Subject: [PATCH 7.3 047/742] xhci: keep port link_inactive and connected flags in sync when polled Date: Fri, 4 Dec 2026 18:58:31 +0900 Message-ID: <20261204100636.316822875@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathias Nyman [ Upstream commit bb261776d1a29768b8fd84eb4f42d99dafa29c93 ] Update port 'link_inactive' and 'connected' flags even if xHC isn't generating port change events. xHC only generates port change events on port changes after old port change bits are cleared. Hub driver is often kept up to date by polling the port status. Sashiko reported a possible case where all port changes after a port reset take place before hub driver clears the reset change bit. This way the port can end up connected and fully running with link in u0 without a port event clearing the 'link_inactive' or setting the 'connected' flags. A protocol STALL in this state would set EP_DROP_PENDING, and prevent all future URBs for the endpoint. Fix this by also updating the flags during get_port_status(), when hub driver is polling the port state. Fixes: 6895dbdc19d9 ("xhci: give back TDs and clean up ep0 after disconnect") Link: https://lore.kernel.org/linux-usb/sashiko-outbox-190046@kernel.org/ Cc: stable Signed-off-by: Mathias Nyman Link: https://patch.msgid.link/20261105175106.241182-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-hub.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 470bafe1802be..55430b673f1e9 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1166,6 +1166,12 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, struct xhci_bus_state *bus_ if (portsc & PORT_RESET) status |= USB_PORT_STAT_RESET; + /* track connect and link error status when hub is polling */ + if (!(portsc & PORT_RESET)) { + port->link_inactive = (portsc & PORT_PLS_MASK) == XDEV_INACTIVE; + port->connected = !!(portsc & PORT_CONNECT); + } + /* USB2 and USB3 specific bits, including Port Link State */ if (hcd->speed >= HCD_USB3) xhci_get_usb3_port_status(port, &status, portsc); -- 2.53.0