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 06C13C282CA for ; Sun, 27 Jan 2019 15:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C964021736 for ; Sun, 27 Jan 2019 15:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548602135; bh=SQND22gxiXmsffQR8BvEZ607N2pyHPfXEZbsFHt6XGg=; h=Subject:To:Cc:From:Date:List-ID:From; b=dhX0ZFdxfAQiHG2Ikgvys4itY+YnqXDf9sDnEt/MQdFcFTJqt9eS/UMDMzx/ov9Cg NAISa2rFf1X0+8O9R9lAvsdjv/n/RGRF1iJ2g8I7NpGvL/aeBuzgQKCmxpB2WLpS1E QgnDe98ggYwO28MGWQ/BTg7dr/lXSjYZGE2kEM6s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfA0PPf (ORCPT ); Sun, 27 Jan 2019 10:15:35 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:51241 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbfA0PPf (ORCPT ); Sun, 27 Jan 2019 10:15:35 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id B53906A3D; Sun, 27 Jan 2019 10:15:33 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 27 Jan 2019 10:15:33 -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=LrdjOh U/cxtyNLtq/I/nVUR2YTJ9cu/+4SUX3i86hYE=; b=Wl62BuJDFHxDJd5PGjES4N 8+WWoYWvuy89QXFzAc8kfFc4k3o3XUBl/fVM5tBM/yQClkTIdTXC7Gd+E7jEjTyn KqT8IM+inwsZH5AiGRKs6knqZNeNPfj6zYO0epOwMzPn32FRuf3QPlpyfzFSm0aU rXoScQOinAjiAXab668szQ6yFWM+6/tr2BQQIo6cwjaJFlC5Pcili7fXmpFHRM9M tGbxl0G8uahaAZLJt8RgeEJlkI7Efujs2MANgaCyzkotCuOx24R6aN7MM67bexBX myYtivl2a9th3sShMoTnzzoc9PzQbwmfK6JoLxkJ43x0rEG1UfLOVwqLvJM8nozQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrieekgdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgoufhprghmkfhpucdlfedttddmnecujfgurhepuffvhfffkfggtgfgsehtkeertd dttdflnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdho rhhgqeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedv 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 1AA5FE40D1; Sun, 27 Jan 2019 10:15:33 -0500 (EST) Subject: FAILED: patch "[PATCH] usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup" failed to apply to 4.19-stable tree To: jackp@codeaurora.org, felipe.balbi@linux.intel.com Cc: From: Date: Sun, 27 Jan 2019 16:15:30 +0100 Message-ID: <1548602130213213@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.19-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;