Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2894333rwb; Mon, 15 Aug 2022 13:29:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4fAxqSWSGqD7I9w1az+y+VdCLQWSl0LVxT/NkC+BcUw6khT27oWEZFmH+k4RBNwimrfG8/ X-Received: by 2002:a17:906:7b82:b0:6f3:ee8d:b959 with SMTP id s2-20020a1709067b8200b006f3ee8db959mr11178272ejo.458.1660595393515; Mon, 15 Aug 2022 13:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660595393; cv=none; d=google.com; s=arc-20160816; b=gs6mWR4dV1FDA6cg5oObO0wrMZnc3k6vnjFh/DQPOsuWLdRWEKMJURy1fnRrgC9q6R dF14OnHtz8BDWu3LVs3aZHUMCBNsjW/MIiEdln0ZuDby0XFnj+rbOud9W/cwyUl3swkI EAIVNVjDUz2T6pcphJ9X+8aTLj4YUW58OxLITEbYzyCFYoNoq+jJOVNY4MYEUx16BWi9 VQCz14mzM+VjANJakjyf8pwNK0xXFDVf75mSM1IuY70jlDTQO7CfFWwnnInuPreZT8ur KMhXAG0uBxCG/c1rgmmjh3sKjyxiXpg+T4HaaM62R07McQ6T0rEhdaTEDW2+FE2KRZWC CQJA== 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=mlXO7nM+VgtgmaBktNbGCOYCI0Ekfr1mr4Y7uska1PM=; b=Ti/f8Tsq2pU+TSOTTLKXTBkb6NgmZSTpl12rOOS5NzDZYsgqdObMcTA63rtLplCi3b 2YkQHAtnQzAlCSv7cnpj0a7p/eLtSk76YL2c2q+9oW2dgG8IgmWGYGFjzq9eW4WbwAeL nQXc64RQGvQTzk9eZyOIPPWT4VSK+Ezp5YfWR/m/8HLDhcG8c337w1kSuEKzeDvvIdnB l/klhWGJO7DY/ZYOV3N8ScIiUemBh7kYgwiteJbt/sQvpf7eQmNpQc1WI3/o9Iy0O3Ne LgKBm0Z1t6obrYedFjsLxweofc+gRzJlo6H8XOPVdnWKvnrtM+2yD4vGkKyvmbxpIEmn tN0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B+VG5z9q; 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 lc20-20020a170906f91400b0073124736ee8si7151025ejb.156.2022.08.15.13.29.23; Mon, 15 Aug 2022 13:29:53 -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=B+VG5z9q; 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 S244718AbiHOU1K (ORCPT + 99 others); Mon, 15 Aug 2022 16:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347238AbiHOUWH (ORCPT ); Mon, 15 Aug 2022 16:22:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A04B4B0C7; Mon, 15 Aug 2022 12:01:28 -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 sin.source.kernel.org (Postfix) with ESMTPS id 1426FCE129B; Mon, 15 Aug 2022 19:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9EA0C433D6; Mon, 15 Aug 2022 19:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590085; bh=BPy1qZmW6qarSAy4+2lCRNVA0QAUPJ9Z4/7km8FScoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+VG5z9qS0dZOi0o31hoPF9u69dApR8nuv8es+JE0UGi1rMbaax/JhttkECt9o6ZV O2Zol7rSgMiYCNxK7voA0WBrVVFA9UAzrRPRuTl1z5+cwVGHlI9Gi4hHwhCROpUNso ySET9QCLzh/TnEufVRklZSCTy0BiICtv0MSw1Sjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.18 0129/1095] usb: dwc3: gadget: fix high speed multiplier setting Date: Mon, 15 Aug 2022 19:52:08 +0200 Message-Id: <20220815180434.916608675@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 @@ -1263,10 +1263,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);