Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2812111rwb; Mon, 15 Aug 2022 11:50:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR5j3GHY85lvuHL+uH11WuNrwC5hgZUIsrvxBdEk+Q1/oAwXbxbHUmwPiaNcF3OfQ0OG6Bux X-Received: by 2002:a05:6402:287:b0:43c:c604:addb with SMTP id l7-20020a056402028700b0043cc604addbmr15680922edv.201.1660589429085; Mon, 15 Aug 2022 11:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589429; cv=none; d=google.com; s=arc-20160816; b=0Lv0EyzM5F2qoptvNlgwTWvO66WtpbfjteW12qabA32tQksd2sbgHyYj45OsGR+E7c 6R2tNCdLb7aj2CFem8fFrL4abG3uKY/Z9LGhU3/vLbKA9uAyIvokdUu1Bk1JGnXsvaCh SUQCHTonMi+xlGyfg4SO4cOr3X4XxPemhm5Jji0v6CQRq2Igz5vUfJOzTq0qJnrNUMWX 4EUNhBgV2d1GrZ7qChN5mXvkrBSR0H25tWpVQBUJJmyUOp/ASz0bFhJV/E7N+ykvNJ5M eqxGWpVSDFjqfbzOISdIsBILU0xyDjeN9lQYBxnNmiIBL8PIGJkb3xXlnfsmsdUDAwzt VHIA== 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=wv9oV6UguiinpQwgzG0Zrt8I0UlMfqE8GggMy7SPcZE=; b=xhFsg7yBv0CpVlvVFBCrLu/sXFltadsjk2c/nXNgEqauiiRe2ZJsdezyouRapLJbdw BFj8cp3KMIy9OedvuZ3ceIM7WgiqTfut7MF/OFb0bY98Gv/V/IqAOvhj0amwPPcEBoXi WmtmNXkaEoU1YjCmsn2t4eVqlpIMOetoAIC2oWZn2MjX8w4nchzBFpk5V7jl5tBttqN+ b/SsfTh0S34nmCs1RsxfMXWOORt6VQb/5X441D/V560lxH+kG43KRDUWwcI/VwU9fxii tGK9Tt/xE7AKT8o+bYQL3xMuFmeSWr6UvWpMfi8lqIRWLbZ+7v5HhZX519B49TkXavVa 616A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JoMka8wA; 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 ss9-20020a170907038900b007269661baf2si6643947ejb.475.2022.08.15.11.50.03; Mon, 15 Aug 2022 11:50:29 -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=JoMka8wA; 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 S241693AbiHOSZ3 (ORCPT + 99 others); Mon, 15 Aug 2022 14:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240476AbiHOSY7 (ORCPT ); Mon, 15 Aug 2022 14:24:59 -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 E12E02F01C; Mon, 15 Aug 2022 11:18: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4832F6068D; Mon, 15 Aug 2022 18:18:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39D16C433D6; Mon, 15 Aug 2022 18:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587501; bh=x2i5Ts8YzBr9qGHwch9dGyICGNpTc4V6+o6yggRv1oQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoMka8wAHRkl0euyu6QuH9U2F/uNGOlJ0r6FRcleSRXOMtY8lrkjsMXfb2vlLXb0J oh8Fq+2R2ke3WFuA+aLgvQpEEo0sSjQ8mn0ve84tkCNrSnXvJ4pnP4d/KeOg5U0qmp 4p/ZVSMLiyHsQRIacUu6fxjTfG8sQ4I42lubiJJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.15 105/779] usb: dwc3: gadget: fix high speed multiplier setting Date: Mon, 15 Aug 2022 19:55:49 +0200 Message-Id: <20220815180341.812914884@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 @@ -1251,10 +1251,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);