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=1796203312; b=0RVK5huXKGEqaoqL/FrFaiSxqh1pFjvJVkO3zfOGR/YCLSR/yQPbvSPEFj4AQelTVT/x N8pn9hkAk9P6n+Y1Gk9I31feqdnFtP45Rx38ial9vV2up1nMJCFR5vEM+VyALm9JEfpdP ZjUg1TSl9/WrAlnRDPKndFFwuNAM4pesse5J4ReUxP6s3WmdTl0DP/7+RZJn+119jcZ44 q9fWneSejySww7KDxT71YjJgFWorzFwWITem4hgQ6pz6q+JNusI8CWmlqxZk3d14A0dwn K/xzXyJ/QNHR5lcyLsdmUSf7sIB487rpW/i8rgPEfcbyHJC6X3diABIJ5b1C3CS1doQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796203312; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=TKtRsiTh4Ppj+Vz2aUUN9Anx/Rca6HJXvlWRoFEbMYQ=; b=1Krbm7N+DQTfSt2xztT8VRzYDKnSwP6a5TRzaJYxh93QQXFvEVSu7w+9uv86iXHWCmzo kJcYi5hDCZW836cQx6NdLGPsO28aaR9jK6skwBc1eshBSf7fXTDODdV1/Nd53Bg1kQwFd ztCH23lNLiTo1CGzwjyU/ZiFHMT2KiPggsTMsS/eYE8dG+t7yx2UAlPJROOFgxG2hW776 hDwweHmyf6OXragmzIAOIQUBCLEovx5j5Pc866cHBMFVSEHvfuJFgEHXeWwn5b25xTbOV TmFeEWYPK23OAS77SDQkhDRlaZpDaX7cWlOYfDzzPdApcio2poBVCLFoqULBbixdbBg== 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=Cv9EdWfK; 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 818C2606A32E for ; Wed, 2 Dec 2026 09:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Cv9EdWfK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 792F31F000C1; Wed, 2 Dec 2026 09:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796203311; bh=TKtRsiTh4Ppj+Vz2aUUN9Anx/Rca6HJXvlWRoFEbMYQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Cv9EdWfKL10WTnReiGN5JTvD0u7Imk2AWmvgtJKGY9Hp2/buGa+UkDf8s4kD7Vyji TyebSN8MV4yXqBgMkoEcsHmFTGE5gj7AgF7GtwMHppkBRIDrPf4VQrizben+j2DCC4 VntegWAjv/+C2ClBu0fRiiR4veuWavhkWnctbW0WFbBFw+69Ohga/ytK+QBsVSWby0 YLv+cB+wnZrx3FgecUbKOhje3k3YXcy5CGwY8grKaKX0komFHybvmWWJjcxS/9JG/4 +6NLnAQgBHRJ4l/l2BGRYgZLoBGa84xGRsso25ELCzBqJZf3nP87EJLEY3fdYb1MG6 5tKKG3CHrOpdw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] usb: xhci: Work around the ASM3142 bulk UVC bug Reply-To: sashiko-reviews@lists.linux.dev To: "Michal Pecio" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261202101200.726fc9e3.michal.pecio@gmail.com> References: <20261202101200.726fc9e3.michal.pecio@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 09:21:51 +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 1 potential issue to consider: - [High] usb: xhci: skipped TRB loop for zero-length URBs in xhci_queue_bulk_tx() -- commit 771a636094579efceb79700d7566c1836f19f8ac Author: Michal Pecio usb: xhci: Work around the ASM3142 bulk UVC bug This commit adds the XHCI_NO_LINK_AFTER_TD quirk for ASMedia 2142/3142 controllers to prepend a No-Op TRB in xhci_queue_bulk_tx() when a bulk TD would end right before a segment Link TRB or start on one. > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index 7ccd89a4b9951..9230db6f8bc2c 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -3700,6 +3700,20 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_= t mem_flags, > addr =3D (u64) urb->transfer_dma; > block_len =3D full_len; > } > + > + if (xhci->quirks & XHCI_NO_LINK_AFTER_TD) { > + /* > + * Prepend a No-Op if our TD would end before a Link TRB, or if > + * previous TD failed to prevent this and the HW bug may occur. > + * FIXME: multi-segment TD and/or TD shortened by alignment. > + */ > + if (last_trb_on_seg(ring->enq_seg, ring->enqueue + num_trbs) || > + last_trb_on_seg(ring->enq_seg, ring->enqueue)) { > + num_trbs++; > + first_trb =3D false; > + } > + } > + > ret =3D prepare_transfer(xhci, xhci->devs[slot_id], > ep_index, urb->stream_id, > num_trbs, urb, 0, mem_flags); > @@ -3723,6 +3737,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_= t mem_flags, > start_cycle =3D ring->cycle_state; > send_addr =3D addr; > =20 > + if (!first_trb) /* see XHCI_NO_LINK_AFTER_TD */ > + queue_trb(xhci, ring, true, 0, 0, TRB_INTR_TARGET(0), > + TRB_TYPE(TRB_TR_NOOP) | (ring->cycle_state ^ TRB_CYCLE)); > + > /* Queue the TRBs, even if they are zero-length */ > for (enqd_len =3D 0; first_trb || enqd_len < full_len; > enqd_len +=3D trb_buff_len) { [Severity: High] Does setting first_trb =3D false skip the TRB loop completely for a zero-length URB (full_len =3D=3D 0)? When first_trb is false and full_len is 0, only the TRB_TR_NOOP is queued: no TRB_NORMAL with TRB_IOC is emitted, and td->end_trb and td->end_seg are left NULL on a TD already linked into ep_ring->td_list. The URB will never complete, and the next transfer event or URB dequeue on the ring will hit a NULL pointer dereference in trb_in_td() -> dma_in_range() -> trb_to_pos(td->end_seg, td->end_trb). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202101200.726f= c9e3.michal.pecio@gmail.com?part=3D1