Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4571171rwb; Tue, 6 Sep 2022 09:17:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xTYjF83RcXVYmQJ3Dg6kOFG9NtnSw1RqRwkqkfD/aEVF/XteOqub2d+0oooY/UT1yNCJl X-Received: by 2002:a17:907:2724:b0:741:4a1f:6159 with SMTP id d4-20020a170907272400b007414a1f6159mr32246800ejl.542.1662481030181; Tue, 06 Sep 2022 09:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662481030; cv=none; d=google.com; s=arc-20160816; b=HIuLSWEOlC2IJaPo5mx3IbboU1JX2WeAP+NFnjONXYAuNck7R5mfiMGRk3tGJPBrb3 xvd+Pv170Div8vuPzy1S2wQFB6CG5dj7ldhaFv6zzwYxDgPKgcGC7TtR1oSzGQBoGFA8 KsQ8g7uoQKyzRiy9EqxzO8Wrc7swn88dGVbdnglxt4H0uvymmpeOnSqUHxHu9bpWJ+5H kEreGd0Mxq5fFeAW3AOPAaUcYhiMe2EteSWgpP3gMxAyVsvuDykvxVxHck16FvwN/Eih a/W+HYBJvOeqmeF5q/fYq/cn0RirfqSWFx5/wTxKuChujwo/BISsDIj5/uNUezh/rx8k sEzg== 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=zImwIYfrQwsABQ83rYW0GM2DLncNotTxfbtBtz5y8ow=; b=j+QcrTYM5RVkqnKiLsGDUi1AVou71xSkTRA4bLMoLSjzGZNdCJzF3pOQoLsHT4fnSq kbj0AWA+cIChcRaVj3Y0icoytM2wDazAW+sTmqBYAIMTf0MNRHsizCL0cTta8/N7pcZf ATg/r3BP9DxgNJy1TeAr3dgc9uBfxU8Skd+eaAC8CCgosRhVv88f3yM/w2EJmrK5DjXT bQQF9lMiSFBzrkK4ESFKrnwb7rjtmlrzs5cDfiyyHrQ/1mQWRgo9B+TEHCSpeJvW5AnU p1nCzbA1KNN7Kphn7JtVbjWJdbcsXKJdxQkNxXeMBz9RKURUAbQ1nCvN3PmAo0oBlI6X VTcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ES78OO6u; 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 s3-20020a17090699c300b0076febee8f6csi643489ejn.886.2022.09.06.09.16.45; Tue, 06 Sep 2022 09:17:10 -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=ES78OO6u; 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 S232991AbiIFPJg (ORCPT + 99 others); Tue, 6 Sep 2022 11:09:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233834AbiIFPJE (ORCPT ); Tue, 6 Sep 2022 11:09:04 -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 DCF84B24A3; Tue, 6 Sep 2022 07:23:10 -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 45EA56156A; Tue, 6 Sep 2022 13:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510C5C433D6; Tue, 6 Sep 2022 13:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472036; bh=YM7Bw6cpN4RXY18w8OktI9pgS4kPSobcls1f2al2jmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES78OO6uTWLNjml7FPKZ8ErZlkgC6FvDUUQvTzqt+RcBZw5jWc3eRt0GPB7SGgJSo MTHaQPWZpLRACdk08AOvemQFpE9IefIIqfWMdbJOXcgU8JkP5ckzmKvMUZdFEdo+4P Ih+HSd6FQV8iJXgLAh524IZU6Ih3xuYHpbnrOLuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Pawel Laszczak Subject: [PATCH 5.19 125/155] usb: cdns3: fix incorrect handling TRB_SMM flag for ISOC transfer Date: Tue, 6 Sep 2022 15:31:13 +0200 Message-Id: <20220906132834.736664720@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@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: Pawel Laszczak commit d5dcc33677d7415c5f23b3c052f9e80cbab9ea4e upstream. The TRB_SMM flag indicates that DMA has completed the TD service with this TRB. Usually it’s a last TRB in TD. In case of ISOC transfer for bInterval > 1 each ISOC transfer contains more than one TD associated with usb request (one TD per ITP). In such case the TRB_SMM flag will be set in every TD and driver will recognize the end of transfer after processing the first TD with TRB_SMM. In result driver stops updating request->actual and returns incorrect actual length. To fix this issue driver additionally must check TRB_CHAIN which is not used for isochronous transfers. Fixes: 249f0a25e8be ("usb: cdns3: gadget: handle sg list use case at completion correctly") cc: Acked-by: Peter Chen Signed-off-by: Pawel Laszczak Link: https://lore.kernel.org/r/20220825062207.5824-1-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/cdns3/cdns3-gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -1530,7 +1530,8 @@ static void cdns3_transfer_completed(str TRB_LEN(le32_to_cpu(trb->length)); if (priv_req->num_of_trb > 1 && - le32_to_cpu(trb->control) & TRB_SMM) + le32_to_cpu(trb->control) & TRB_SMM && + le32_to_cpu(trb->control) & TRB_CHAIN) transfer_end = true; cdns3_ep_inc_deq(priv_ep);