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=1796154475; b=WFC292WPHH+RvdunpOLE6njeQ6OBuop3BZdQD6Q7nn7VDOWdLSQBRqA6Qq1ZhO/aPW+d v/ttwFQ/TQPRFiLbG9Yv0wyq/4RPRyao8Le2DJ41QRBr+7woZ7caGJ86sQRdPEjFidjQk dbeqNcDzhKlWo/wDOj4KTcQiX8YkaqONWvyshngbYUA/0ZxoueBjTt/kuZKU7Cu9k0DZR D44oRIfk+w8c0PJm2wi02rYpQQ8JZFweYmpEHmrCsjoWSWWS+OXFA4qA0o3Qg7rJJy7pU bAC4DE5xiTOR37syNnYK9IcC/x0FpsDFkMJlaYs2f6Kf8uFKHdNY3ma9FmV4x4tcHvQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796154475; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=k7guVJeaAj61CvpEAka+hK+qyqFt0LkhJMD2t+GJv3E=; b=dZdzUIh5jyVh99xg666W79MueQb/JvFSspPpAthfBTo3lb4fk0IazJZAZrG9rNqoUmDn 9Bvy9U/KtepW71msnTVA1qfIDsgo4+NiO180wlpYd/kvk7lu6oGtrpbc/2qdFhOWA9Ntw /Gd9oP5zjrV0/gLAOdzC2n0DteXbyrke/4OAEN8lV9eunNWLEPBMkW0mQfvAtitR0U2A7 S4a+9wR+lebYHP2nMZAaovkiJvgM/xgQbfcjIB5LqzC35GBWQMxDPuWkxVj5KaH01R7JE pViqSOvyMoQxxFCLGs9jRIBhvpq1yBiGuLoe2RPGj1ZNLhlkEiki1AZohGyPtclL61Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VvM4etaM; 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 C9CE1606A334 for ; Tue, 1 Dec 2026 19:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VvM4etaM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95E851F00893; Tue, 1 Dec 2026 19:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796154475; bh=k7guVJeaAj61CvpEAka+hK+qyqFt0LkhJMD2t+GJv3E=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VvM4etaMxNHLCkqCZMdq+ApgyrHlIcztmALd/4b1KdC6PI9kdwvTW5RNp4xASywGE 8/Qcj/Bx2rBlZiI6DfJhNQYLJE8Y6a6il7GaQY1pR1k43UPjHi9rs88BgADMuAUJsq eSfQ23K549mc2mtKtqqNx6pmOz6VDXJ0b/MeaW4AArf5ywBAG9KJFGfkFxJm1Pj0W4 Kt/GeFPMlIJuTo22hEEKicZSkeWXioXW4O1JQAJJ4epzLyclHYI3RXZckgd5dMMpkR SB5amRUX/grm+h7ws8irQjOHGQjir8lhvnuSb9FaY3Dkb7vR2DIIR7eiSU9i/YKg22 ddymP/MwLoNVw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/7] usb: xhci: simplify xhci_get_input_control_ctx() Reply-To: sashiko-reviews@lists.linux.dev To: "Niklas Neronin" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261201194134.265480-2-niklas.neronin@linux.intel.com> References: <20261201194134.265480-1-niklas.neronin@linux.intel.com> <20261201194134.265480-2-niklas.neronin@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 19:47:55 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] usb: xhci: race condition in xhci_free_tt_info() [1] -- commit e4be7ecc7f7cb6e246c200a24855015365ab6a17 Author: Niklas Neronin usb: xhci: simplify xhci_get_input_control_ctx() This commit replaces the NULL return in xhci_get_input_control_ctx() with a WARN_ON_ONCE() check and removes the corresponding NULL checks from all callers. > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index 7f0d34c465f8d..de04a7b705f84 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c [ ... ] > @@ -5267,12 +5198,6 @@ int xhci_update_hub_device(struct usb_hcd *hcd, st= ruct usb_device *hdev, > return -ENOMEM; > =20 > ctrl_ctx =3D xhci_get_input_control_ctx(config_cmd->in_ctx); > - if (!ctrl_ctx) { > - xhci_warn(xhci, "%s: Could not get input context, bad type.\n", > - __func__); > - xhci_free_command(xhci, config_cmd); > - return -ENOMEM; > - } > =20 > spin_lock_irqsave(&xhci->lock, flags); > if (hdev->speed =3D=3D USB_SPEED_HIGH && [Severity: Critical] This problem wasn't introduced by this patch, but can xhci_alloc_tt_info() and xhci_free_tt_info() race and corrupt the root hub port's tts list [1]? xhci_update_hub_device() holds xhci->lock while xhci_alloc_tt_info() adds entries to xhci->rh_bw[...].tts. If another device on the same root hub port concurrently fails setup or resets (for example via xhci_disable_and_free_slot()), xhci_free_virt_device() calls xhci_free_tt_info() without holding xhci->lock: CPU0 CPU1 xhci_update_hub_device() xhci_disable_and_free_slot() spin_lock_irqsave(&xhci->lock) xhci_free_virt_device() xhci_alloc_tt_info() xhci_free_tt_info() list_add(..., &rh_bw->tts) list_del(&tt_info->tt_list) <-- list corruption spin_unlock_irqrestore(&xhci->lock) The concurrent unlocked list_del() can corrupt the tts list pointers, leading to a crash, infinite loop, or use-after-free during subsequent TT bandwidth checks. [1] https://sashiko.dev/#/bug/linux-3e30f7e2-c6ce-4541-8c1c-3eafceec7003 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201194134.2654= 80-1-niklas.neronin@linux.intel.com?part=3D1