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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS 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 64CADC282CA for ; Sun, 27 Jan 2019 15:15:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 346FC21736 for ; Sun, 27 Jan 2019 15:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548602124; bh=iqsBbO4R37+lRw0ZgsaLU66s8H85thTxPCRs9W0m3As=; h=Subject:To:Cc:From:Date:List-ID:From; b=ck+axLh1Tbvh+eYzZ6OtRAn+jO4tfk5K0dB0u7dn49Wi7qSHKPurYhNM+N8ngfIld RV2k5IqrD9lsl+S5TisZU5ZdgmJP0JJ+5RpssegzfSCvTc8kHbDEpwqI+QpVQWD3G/ SzmL2tyIr7XP/6piMVB9CD+r/843tZ1m3bKFS6lI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbfA0PPX (ORCPT ); Sun, 27 Jan 2019 10:15:23 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:48453 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbfA0PPX (ORCPT ); Sun, 27 Jan 2019 10:15:23 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id D7563BB67; Sun, 27 Jan 2019 10:15:22 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 27 Jan 2019 10:15:22 -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=5Sf4HG t00SngDOOxsWrZj4UKLfGiE79fed+6K0OT5Ek=; b=kuUMWUOWn48nu5Ofi2rLwz TvKmImEHFghLjBdSOuidxiWQJEOT6apMiA3SbfDctiJqA/eaSCBnmk95FpbISbpj uCXHv3QTLF9kcjgKVzlO4RH75WBCguTzkV0hT9i+Tnc6j5iWg5ygaAXWHdgmU/BV MF4GcRHlH99QW4ERx3v47WV7uFBff6j4KwqzUwdcESVPJLK5WES+aQ73c2uyqNBe 0HvGynpM7Ty8H8oYqwiH8o+/iy1orRv1gQlnRM25ye4xgY/WBzJyrj1LsuPDlmzw 9PWE4ie5XntSRwwzQidOBtIYtKRGepMHaGnJ4JPsHE+WDSlyfF4cxVBEciL0zFVg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrieekgdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgoufhprghmkfhpucdlfedttddmnecujfgurhepuffvhfffkfggtgfgsehtkeertd dttdflnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdho rhhgqeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id D3EA9100BA; Sun, 27 Jan 2019 10:15:21 -0500 (EST) Subject: FAILED: patch "[PATCH] usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup" failed to apply to 4.20-stable tree To: jackp@codeaurora.org, felipe.balbi@linux.intel.com Cc: From: Date: Sun, 27 Jan 2019 16:15:20 +0100 Message-ID: <1548602120114166@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.20-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 bd6742249b9ca918565e4e3abaa06665e587f4b5 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Thu, 10 Jan 2019 12:39:55 -0800 Subject: [PATCH] usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup OUT endpoint requests may somtimes have this flag set when preparing to be submitted to HW indicating that there is an additional TRB chained to the request for alignment purposes. If that request is removed before the controller can execute the transfer (e.g. ep_dequeue/ep_disable), the request will not go through the dwc3_gadget_ep_cleanup_completed_request() handler and will not have its needs_extra_trb flag cleared when dwc3_gadget_giveback() is called. This same request could be later requeued for a new transfer that does not require an extra TRB and if it is successfully completed, the cleanup and TRB reclamation will incorrectly process the additional TRB which belongs to the next request, and incorrectly advances the TRB dequeue pointer, thereby messing up calculation of the next requeust's actual/remaining count when it completes. The right thing to do here is to ensure that the flag is cleared before it is given back to the function driver. A good place to do that is in dwc3_gadget_del_and_unmap_request(). Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Jack Pham Signed-off-by: Felipe Balbi diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 851fd44d56ad..6e2b6d6369aa 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -177,6 +177,7 @@ static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep, req->started = false; list_del(&req->list); req->remaining = 0; + req->needs_extra_trb = false; if (req->request.status == -EINPROGRESS) req->request.status = status;