Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1156104iob; Wed, 4 May 2022 16:08:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysNKd4AiUplePweE4NI6qdmilBrZK+QhIMh6xtVjUmc5ZsGMjeYLIwjOk2AhTpQidc6bbe X-Received: by 2002:a17:906:9b93:b0:6da:6388:dc57 with SMTP id dd19-20020a1709069b9300b006da6388dc57mr22196360ejc.338.1651705717556; Wed, 04 May 2022 16:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651705717; cv=none; d=google.com; s=arc-20160816; b=Fms4tWijK6oFA7xp1pBM/3kit6QYv37+FooatfwHpKyTkcNAQrYk7DvAWdvjNfGVv5 WHV5LPJM5b719Sroe3xnNBZunNS/2JATg5fXWKrLF7mXfEIiIum3g5+ebn8GT3fqtehb 5vafjOt1G1Up/LFLIsCrzXU+HhzrR3gwKYl2et4Y1Hr4u9aJ5e2RRLweaD0158evVNps 6k/uLk+hmz/0WQMGMrLPA8SRcLHLtHOVgkr2cxOlUkZur2RGag/S1kXr2ugs0yF5TTWc r8aJw/zECWtyeG8M0UFhjMd4aY/q+LBmI65qlvW/HidZ2W4IcTGcunun6xjqctoiGZ3g Fumg== 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=91NJNt7dDoAg4r7lVpvUhkygGRnJt5ddjPW0O0btuV4=; b=OMEY9fmeq+7Ceel+gtgDkkMzUsSNSKQUNvGxLQXsu17cYSGeJ5qmJJcpaIOK508rUo Wodshb7G3pti5eav0bAJVGKdf++e//xxPrR3eaFgu/REYcVk417RlvEG0lDE5wnu+7T5 mPLgiVQQwBcO2pJ/qMjhyKvEFza2Njp3h1x/9RZbgh99EgDaZFdoUILFtBfQdctBcFPI AJN8lqHAkvWB811+o8CqdCU+1CWzR0mamlK9RnxPlazv/mrD8wTM9NyqxydQXq+ENEDE vdNSyTv8/ZX/0XeXm+huXM7s7F+41WivVn7h2lcqS+NWDX5SHrc+esx+GbmWM9/8z+rc MVnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2LG3dKeR; 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 b16-20020a170906195000b006f47e87800csi207969eje.706.2022.05.04.16.08.13; Wed, 04 May 2022 16:08:37 -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=2LG3dKeR; 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 S1357557AbiEDRYk (ORCPT + 99 others); Wed, 4 May 2022 13:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355413AbiEDRET (ORCPT ); Wed, 4 May 2022 13:04:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA5E64EDC6; Wed, 4 May 2022 09:53:02 -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 2381FB827AC; Wed, 4 May 2022 16:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C773AC385B0; Wed, 4 May 2022 16:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683175; bh=GYqdHF/kWbxCt6a86UWjM3QOO2fhmQgGD64+8+8qvrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LG3dKeR0HCc96BFRvMCCasWjm6W63ykKDPF8XThabZ+VlVn9Koj+Q7MLCzIESTIT zZ+oHK3Q4SI/aqfkVbMQf5vNFovkAOyzJquRVzL8Rcv6Dz7/1rSEKefh5DjSWHO/EE r2qKEhqN0WMMxsYLKktdOaiRb64HEdkNayutnqp8= 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.15 027/177] usb: cdns3: Fix issue for clear halt endpoint Date: Wed, 4 May 2022 18:43:40 +0200 Message-Id: <20220504153055.521161879@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@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: Pawel Laszczak commit b3fa25de31fb7e9afebe9599b8ff32eda13d7c94 upstream. Path fixes bug which occurs during resetting endpoint in __cdns3_gadget_ep_clear_halt function. During resetting endpoint controller will change HW/DMA owned TRB. It set Abort flag in trb->control and will change trb->length field. If driver want to use the aborted trb it must update the changed field in TRB. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") cc: Acked-by: Peter Chen Signed-off-by: Pawel Laszczak Link: https://lore.kernel.org/r/20220329084605.4022-1-pawell@cadence.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/cdns3/cdns3-gadget.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2684,6 +2684,7 @@ int __cdns3_gadget_ep_clear_halt(struct struct usb_request *request; struct cdns3_request *priv_req; struct cdns3_trb *trb = NULL; + struct cdns3_trb trb_tmp; int ret; int val; @@ -2693,8 +2694,10 @@ int __cdns3_gadget_ep_clear_halt(struct if (request) { priv_req = to_cdns3_request(request); trb = priv_req->trb; - if (trb) + if (trb) { + trb_tmp = *trb; trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE); + } } writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd); @@ -2709,7 +2712,7 @@ int __cdns3_gadget_ep_clear_halt(struct if (request) { if (trb) - trb->control = trb->control ^ cpu_to_le32(TRB_CYCLE); + *trb = trb_tmp; cdns3_rearm_transfer(priv_ep, 1); }