Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3025915rwb; Mon, 15 Aug 2022 16:23:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fChUeqxYvq85CEZ5BG4PD1dXvo/Xwnkw7QI32yOFJSG0FYiYTAKK0qgmyiwDy6xZenJUB X-Received: by 2002:a17:906:d7a9:b0:731:2189:4f58 with SMTP id pk9-20020a170906d7a900b0073121894f58mr11968843ejb.471.1660605837883; Mon, 15 Aug 2022 16:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605837; cv=none; d=google.com; s=arc-20160816; b=WOhFTEG1RFgLV6ZAsSbKKaVXZ2xPyDzSu1/is/lkYXUYmO2/sRxJkN6Nt9pdE/ZkGG EqiHud4laQd7sKPu+ArzF4+V+2A9oPEN1vKz5dUVWnEnxheu0yqiBDsGp1en+Y91tToX PiI9o525azoBljxKpXij/wtzgAAfszd0JTKWwswkI2t+7UmCVioNkT6ieBc2ZHOnqwQr mtyrC27YTGXQVPBt1HdyEWt3YV8PshtTnagw6ra5VQiVu/ncED8m3yLBJ44Jsafw29Bz j5DrSvAndPAxj8df3yCmJjjDQFech+Mi9TP8HvF9WqKp9lL0RvSJnP7oQHFH8Hd77kmS Rflg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3jZLG0UIZYa/5IKarVXzkQyXyX4pVMoZFK4Xx8FBzpk=; b=v9AeVeB+8GAE6gxWAN/9C1SsPytPGVYf06KTAXQ9RQoWsiNJWsNWvp9vy5CcgO0Ifg MHdr8RpzWAFPodUYcFdUca0vWwqOf8R4HrLYkg0xJDGz5BN1+gTES2s+5PmXANU/QCps 36cgExwl+It2NGRLXkavcl4N/drhdZVOcUndaU0oK5vz7U834Hyy00ytowfEFYn20rkL m4QiMnU7o9NyPif/c+rmf0yYqO0cGHX0iyHkFmupm4VRInuMTIgBEPrXbONltuGnRaAd vMnAHxfUcty+6XFfkwzXvxRy5j56KX0Ruty+jWf5oF3oZpZTZHg23uGMcJE3snw3m7jk bUvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v12fKWm+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr2-20020a170906fb8200b00707ad2d64edsi8356875ejb.98.2022.08.15.16.23.32; Mon, 15 Aug 2022 16:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v12fKWm+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244896AbiHOW2T (ORCPT + 99 others); Mon, 15 Aug 2022 18:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349770AbiHOWVf (ORCPT ); Mon, 15 Aug 2022 18:21:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85B9FB5A55; Mon, 15 Aug 2022 12:43:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id C3B77B80EA9; Mon, 15 Aug 2022 19:43:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14837C433D7; Mon, 15 Aug 2022 19:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592623; bh=qVsnoEGnc5qFPD1U5EZTUH1PL3z3jAHDLEAbNbMTyz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v12fKWm+5LN8Qq/hl1Grvfg8wQHNwWI6kCQNxocNic2gKiMeJLkf7Cu9/nskcvi/l 78l2ISy9SjSSfcrR3mVBPeYZzHw7psUsDAL/GnLnQynS+STw9Fjv4FaIYJZ4tIwUzi cTaoa39DvE88B09CBDBFjPsqPKuV199AC7d0jjus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.19 0139/1157] usb: dwc3: gadget: fix high speed multiplier setting Date: Mon, 15 Aug 2022 19:51:35 +0200 Message-Id: <20220815180445.188777902@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 packets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengutronix.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 @@ -1264,10 +1264,10 @@ static void dwc3_prepare_one_trb(struct unsigned int mult = 2; unsigned int maxp = usb_endpoint_maxp(ep->desc); - if (trb_length <= (2 * maxp)) + if (req->request.length <= (2 * maxp)) mult--; - if (trb_length <= maxp) + if (req->request.length <= maxp) mult--; trb->size |= DWC3_TRB_SIZE_PCM1(mult);