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 52036C282CC for ; Sun, 27 Jan 2019 15:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE8F2148D for ; Sun, 27 Jan 2019 15:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548602128; bh=65mXH+N90He7MiSgb6CH6NaSk6dZJiL9WWUwlaTQ9Ro=; h=Subject:To:Cc:From:Date:List-ID:From; b=d1Np7KduV4+pow3uW0HT/1t2Sklcu895Rj9awyHv4AKu0UzljJm50IdpZyImtkWcS wofS3Vn5Bu18yvR49RwNf2NsuHwdiZk/slGCdVfZLg1GPZQoPqFHcQYLGtVv0DGY/V AjHutlX2AhK78+M/DBVanMYkPtCMy4yP9QoBPqCY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbfA0PP1 (ORCPT ); Sun, 27 Jan 2019 10:15:27 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:45413 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbfA0PP1 (ORCPT ); Sun, 27 Jan 2019 10:15:27 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 86704A68E; Sun, 27 Jan 2019 10:15:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 27 Jan 2019 10:15:26 -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=KaY/jn sZccNwkQqO10inVOGGVwZ0a/fBqG3e2LsHLws=; b=WuwTJhnaPCwHmadIRFCasj BkJ1lpHW/CVoV1EJAqOdoUxsIV0YBKDcCJpOf2gxWbBzMVeO7jTQZtiYURcCb1ov sQ5x1+8vP4HA+gAsdYbivXpkaFV4LXx01aSC2aSd2NCq6uYoe/fcs2BraawPygta v1UTukaoHJKztRDtedJ0cS8NzGO6IwfzQIfLpk3tvD40dmFQDfn+5ry8JE2BqJVy LzT45zDG02glEY5zOeWWEyhE0q13YGsKD/Wf4Jnj5z7Vla4OwyK+cLtoMhxpWi6T LHz1OXJIOvobseUoyC29e2qMeM3lO1S/JB2flqU4jKSSJvENeo/kpJhLezr1lUYw == 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 E0AFDE41F3; Sun, 27 Jan 2019 10:15:25 -0500 (EST) Subject: FAILED: patch "[PATCH] usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup" failed to apply to 4.14-stable tree To: jackp@codeaurora.org, felipe.balbi@linux.intel.com Cc: From: Date: Sun, 27 Jan 2019 16:15:24 +0100 Message-ID: <15486021247362@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.14-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;