Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2933288iog; Mon, 20 Jun 2022 07:46:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sPesFAqgLAuGyCL1i7E7Ni8QwW59cYGjsyFE71cCRxu5jjgCgTTE9qkhF6ayIg1x+AWYmX X-Received: by 2002:a17:903:260d:b0:16a:20a2:374d with SMTP id jd13-20020a170903260d00b0016a20a2374dmr6827309plb.127.1655736401829; Mon, 20 Jun 2022 07:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736401; cv=none; d=google.com; s=arc-20160816; b=mSqdNTA9C9XZ9eevHt/j/anlVdzEXcEM9spamSKSEVPaUN/YgsHqnkBHwA0Ub7byGh u6+0uc3Lu8FPX6914NdG2oTGHd4hJxsHN409EQFXhoRG15mBW4caxQoOuE9rPUzBidn9 ngB2gGTX+RMCYm6cGZHikH+bulVw3993dMGCJzX0WH5pQvSFJhUWZrwOCRlBhO1BeqwX YjspTeewLD7Gaai/ABtH/sn/mO5b1HWW6Cls8ReRoNwtXM5vD00yIN5dbKCpuKjAhvjX JvvEaWCRiGGRFyS1u8UkBTlGdv6lD9AUwuI7xL871WKrnidx1EYTTsGinV8Ta2UeeIFQ P+hQ== 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=aBfVd7hy0coEu6sPB1Iosvg9RJWecXt+S1MZ1T9G+kU=; b=gVqehgGhU9UtC5NQnU1+HSz2lJ+xEWaekwvqxSX5dgHhejJRxpCC2l9mm7FFJqKfAr MW4WxaKXsUmdnRFDio3XmvagvTRzDRIqujqsB8fk9oRMHnR2KujAGtu6NR/alixK+AIL ugmCKDPuoyz7bqomyD5/TpRrCa7WbzAVmaVeGf8/lrV2hjIgBvwNqQDjdPjaBwdnfCrT wyendpCoKq8CCqTLIktHSu7aoNnx6For/xcaTniyePWjpBu6auU+6GbnDnGS57/fbnwT 0AmyWIF4BEiSAVKUqHD5OeKyt4rSAbj5V8wcEgTVtvhZx9yQp884DlkNHOBFNFdy2uwe iqdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jarla3o5; 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 t7-20020a170902e84700b00163a0f48480si5320962plg.36.2022.06.20.07.46.27; Mon, 20 Jun 2022 07:46:41 -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=jarla3o5; 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 S244430AbiFTNFT (ORCPT + 99 others); Mon, 20 Jun 2022 09:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244551AbiFTNDn (ORCPT ); Mon, 20 Jun 2022 09:03:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2251E3F4; Mon, 20 Jun 2022 05:58:14 -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 A071D61534; Mon, 20 Jun 2022 12:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF96CC3411B; Mon, 20 Jun 2022 12:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729893; bh=fNMtNd/ZVAeJzffPN0WQglMzH9rYHRFh7UPCRvMC4n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jarla3o5LBDo53pcoqv2SZGDDccNIc15o0Z8N9KRTxH08FDApYUm3vhhxJmrkWalU Myfpc0z4o6dCKhATXV1dPxVRyV6kEy8TDg9QoPs73BQkOrdZwjLE1Vo6mjGANulXv1 ZvrTVTFVuch01d/Kv9USbd21yFRBjeis6c9Ttyno= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Pawel Laszczak , Jing Leng Subject: [PATCH 5.18 108/141] usb: cdnsp: Fixed setting last_trb incorrectly Date: Mon, 20 Jun 2022 14:50:46 +0200 Message-Id: <20220620124732.736244371@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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: Jing Leng commit 5c7578c39c3fffe85b7d15ca1cf8cf7ac38ec0c1 upstream. When ZLP occurs in bulk transmission, currently cdnsp will set last_trb for the last two TRBs, it will trigger an error "ERROR Transfer event TRB DMA ptr not part of current TD ...". Fixes: e913aada0683 ("usb: cdnsp: Fixed issue with ZLP") Cc: stable Acked-by: Pawel Laszczak Signed-off-by: Jing Leng Link: https://lore.kernel.org/r/20220609021134.1606-1-3090101217@zju.edu.cn Signed-off-by: Greg Kroah-Hartman --- drivers/usb/cdns3/cdnsp-ring.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/drivers/usb/cdns3/cdnsp-ring.c +++ b/drivers/usb/cdns3/cdnsp-ring.c @@ -1941,13 +1941,16 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev } if (enqd_len + trb_buff_len >= full_len) { - if (need_zero_pkt) - zero_len_trb = !zero_len_trb; - - field &= ~TRB_CHAIN; - field |= TRB_IOC; - more_trbs_coming = false; - preq->td.last_trb = ring->enqueue; + if (need_zero_pkt && !zero_len_trb) { + zero_len_trb = true; + } else { + zero_len_trb = false; + field &= ~TRB_CHAIN; + field |= TRB_IOC; + more_trbs_coming = false; + need_zero_pkt = false; + preq->td.last_trb = ring->enqueue; + } } /* Only set interrupt on short packet for OUT endpoints. */ @@ -1962,7 +1965,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev length_field = TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) | TRB_INTR_TARGET(0); - cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb, + cdnsp_queue_trb(pdev, ring, more_trbs_coming, lower_32_bits(send_addr), upper_32_bits(send_addr), length_field,