From nobody Tue Dec 16 16:38:57 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57AAEC32772 for ; Fri, 19 Aug 2022 15:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350551AbiHSPx2 (ORCPT ); Fri, 19 Aug 2022 11:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350002AbiHSPwp (ORCPT ); Fri, 19 Aug 2022 11:52:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426E3106B3D; Fri, 19 Aug 2022 08:49:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 324B7616B3; Fri, 19 Aug 2022 15:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FCF6C433C1; Fri, 19 Aug 2022 15:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924143; bh=71bTs8+DdYlyzXQOg/QtkRrEs67hwsdiz1TizUPSiqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZfy+/emT5w9LzS9DS/SxEG382MtR2v5B9SQGjcoZjaTmxocMGTu+DN5SiqN/Fp9F b+UbnxDto1YCi39gljSIOboV31KUAIGORun2q6wLRBVesaQ37wgQ5km2/F3EiZNgFv ZyNXOs75HwgIQSRz9NI1GP/x2bAwD2/fxRI6v9ls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.10 070/545] usb: dwc3: gadget: fix high speed multiplier setting Date: Fri, 19 Aug 2022 17:37:20 +0200 Message-Id: <20220819153832.380922840@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik commit 8affe37c525d800a2628c4ecfaed13b77dc5634a upstream. For High-Speed Transfers the prepare_one_trb function is calculating the multiplier setting for the trb based on the length parameter of the trb currently prepared. This assumption is wrong. For trbs with a sg list, the length of the actual request has to be taken instead. Fixes: 40d829fb2ec6 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short p= ackets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengut= ronix.de Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1052,10 +1052,10 @@ static void dwc3_prepare_one_trb(struct unsigned int mult =3D 2; unsigned int maxp =3D usb_endpoint_maxp(ep->desc); =20 - if (trb_length <=3D (2 * maxp)) + if (req->request.length <=3D (2 * maxp)) mult--; =20 - if (trb_length <=3D maxp) + if (req->request.length <=3D maxp) mult--; =20 trb->size |=3D DWC3_TRB_SIZE_PCM1(mult);