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=1796385672; b=5lpn1HhlfvpPghGLbs2G8A/BtPmHjtJOExZMCfm3hqpqSkdx9R6CKn5AOpY9htV9SwUf d+Md7x8IwvgSfLRj8W9GLQxMf8Hdf5d8ohrN6BdDsUyAoNHV5nKFjWoY1DCa4AmsVkzpy VtW9DpeOqIN1p3zhTFVcUMu+GlRUyvRSD28JfpxRtZ949w4MkOMJ8BSBzUFJf7T8F75Yo RVK+eWA9p6NNojMWCaXzDHv6WZhbMiFRfUinzomvCBiSGnMKi4jW3V0EJlXj0WEURprSM Z2QYkPNfdrx91jE+udDAHAUg/wp+os03I8yAOC0Y3UDGUto+/VoMb8EmNQCVeSD5HhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385672; 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=TGyQPkc3BURgF07oNurJqbyWInSSUgovBkfbjfOWr38=; b=nsvYIEgUq8kowJ/7kUGRr05WsC///fslY8MPMbgVbfyF9W5TfLyHkLsJbP8buc6ZgPvR h6i+ZzsaXjSVZPvEpZieWrap1gdkF3BKwLCEPfT7daMbZeFzeqpioEJQrFsfvlnlK+JMT 6JYNo6+NDR6lCsLuR57Iv3/X0RhAdBJGnaWa1hFovFh9rHYiUzATVTsnG9q9dn+xWCMRx w1PSNgHBxw1wc2QcKXCgRbtZJ0194P/EapKW2/WAwYhUuaY3iBfEEdzalRdGdxXkWithN 2BrkVPfcAGPoMJFG3Kaop5kC3FGjO5lx06yTOwnIr/4GwB7BawRQzjKwQ4nwOX3unSA== 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=CE7vbzmA; 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 ADDFD606A335; Fri, 4 Dec 2026 12:01: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=CE7vbzmA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 275351F000CE; Fri, 4 Dec 2026 12:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385672; bh=TGyQPkc3BURgF07oNurJqbyWInSSUgovBkfbjfOWr38=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CE7vbzmA2GZkznbxZdFkGN2A/FhGOVZEdb3/9+dqQcTKJbRJZqkifsH1lCnpQi8o4 3gqIgHWIVkC6/BBSuNaL9rsy+hFQF4FQD1hbJ0gvy4xAM7gJvZHBdxNFqM2V+aUJ6s kJca+6CkQBh3RzJzlDlNJ+IbPe2eeagVW1ajIsPQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xu Rao , Niklas Neronin , Mathias Nyman Subject: [PATCH 6.6 0647/1167] usb: xhci: disable the correct slot on alloc_dev failure Date: Fri, 4 Dec 2026 19:01:14 +0900 Message-ID: <20261204100718.910565935@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xu Rao commit 2f2fe3201029ffc215b46ac40a0a9587715bc43a upstream. xhci_alloc_dev() stores the Slot ID returned by the Enable Slot command in the local slot_id variable. udev->slot_id is updated only after xhci_alloc_virt_device() succeeds. If endpoint resource reservation or virtual device allocation fails before that update, the error path passes udev->slot_id to xhci_disable_and_free_slot(). During initial enumeration this is slot 0. When reallocating a device whose virtual device is missing or belongs to another usb_device, udev->slot_id may contain a stale Slot ID. The newly enabled slot can therefore remain active, or the wrong slot can be disabled. Pass slot_id, which identifies the slot enabled by this invocation. xhci_disable_and_free_slot() already handles a missing xhci->devs entry. Fixes: 3ffbba9511b4 ("USB: xhci: Allocate and address USB devices") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao Reviewed-by: Niklas Neronin Signed-off-by: Mathias Nyman Link: https://patch.msgid.link/20261105175106.241182-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4103,7 +4103,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, return 1; disable_slot: - xhci_disable_and_free_slot(xhci, udev->slot_id); + xhci_disable_and_free_slot(xhci, slot_id); return 0; }