From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2849AC388F7 for ; Tue, 3 Nov 2020 14:10:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8A1322264 for ; Tue, 3 Nov 2020 14:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604412630; bh=TjPqfcOokK/p0EE8/Ll6Ak68+ajiGQHuX3QLIpDlLJs=; h=Subject:To:Cc:From:Date:List-ID:From; b=RBLpa3Ew3ANDFlwSv1F3r42opqTLjV4c3O7KNv8VGOBKtWUuv/ObZjCv6RTFxFFa3 TA9G+64zUvVCCmpQTq3VRDRPTDMJsdEqoRXzaN0x48UHakxfGL+AbJHl2604EoUyvQ APvhlR+OANfya/PIhK9bAej3bkP+snVgJ5V00lmQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729455AbgKCOKa (ORCPT ); Tue, 3 Nov 2020 09:10:30 -0500 Received: from wforward3-smtp.messagingengine.com ([64.147.123.22]:32881 "EHLO wforward3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729514AbgKCOJb (ORCPT ); Tue, 3 Nov 2020 09:09:31 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailforward.west.internal (Postfix) with ESMTP id DECA9D0F; Tue, 3 Nov 2020 09:09:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 03 Nov 2020 09:09:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=xoNa4t bYR+3v/jRuAZ37YemyucAZBMB9Goz729HQGRg=; b=MYM4cNd8Fd3tDv4rWnxn/U z9h0mvAMj6DKkBu1k0Mq1o176HV9tWUB2ymccWRwX+WRbtZ4CiHrd0t4IVL8/+Vn i/9Kb+eBEZOoSl42iD3awpSMoIa0K3AWkxyDsOhhFZ7HNODS3za6fXFBIuVH7EO1 rQcgNl491t1Kk9DHWzCY27ZPLOVbePwnKkZOwrWTa94x/gVQDvdN9utQLXVDKlsQ KTJwiEXnQdak2Alim6QAj8mPPjRdB62k2XtnYF/zKkuqenRjlzZQygUaeFOLgEtw oHXJVWwwOJ9aEne3Y+5Ru162KyjwzDsbjZBMHdfxhF4Esm7nabBELOe6dx/K92pw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepieetveehuedvhfdtgfdvieeiheehfeelveevheejud etveeuveeludejjefgteehnecukfhppeekfedrkeeirdejgedrieegnecuvehluhhsthgv rhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrd gtohhm X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 2CE183064610; Tue, 3 Nov 2020 09:09:30 -0500 (EST) Subject: FAILED: patch "[PATCH] usb: dwc3: gadget: Reclaim extra TRBs after request" failed to apply to 4.9-stable tree To: Thinh.Nguyen@synopsys.com, balbi@kernel.org Cc: From: Date: Tue, 03 Nov 2020 15:10:10 +0100 Message-ID: <160441261075157@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.9-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 690e5c2dc29f8891fcfd30da67e0d5837c2c9df5 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Thu, 24 Sep 2020 01:21:24 -0700 Subject: [PATCH] usb: dwc3: gadget: Reclaim extra TRBs after request completion An SG request may be partially completed (due to no available TRBs). Don't reclaim extra TRBs and clear the needs_extra_trb flag until the request is fully completed. Otherwise, the driver will reclaim the wrong TRB. Cc: stable@vger.kernel.org Fixes: 1f512119a08c ("usb: dwc3: gadget: add remaining sg entries to ring") Signed-off-by: Thinh Nguyen Signed-off-by: Felipe Balbi diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 7e1909dd041b..173421508635 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2744,6 +2744,11 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, status); + req->request.actual = req->request.length - req->remaining; + + if (!dwc3_gadget_ep_request_completed(req)) + goto out; + if (req->needs_extra_trb) { unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); @@ -2759,11 +2764,6 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, req->needs_extra_trb = false; } - req->request.actual = req->request.length - req->remaining; - - if (!dwc3_gadget_ep_request_completed(req)) - goto out; - dwc3_gadget_giveback(dep, req, status); out: