Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp309722imu; Fri, 11 Jan 2019 00:23:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7FYHwE1EPO72t3zDVncp4jZx4bL+BgSaQhoq1PU8QEplD4lvcjFZFDfwQqGFw/7XuhmfSl X-Received: by 2002:a62:dbc2:: with SMTP id f185mr13468147pfg.235.1547195031845; Fri, 11 Jan 2019 00:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547195031; cv=none; d=google.com; s=arc-20160816; b=y6yLltS4r6PaNRtfWLO8H93qR0EhFwvI9uMS47wDBns/mm06GL3wjZiqSONB0MGYOm dFIEVwU2wd0Dql88XbS2ljZ15/xR6uVYyf/uhgDefLUsNTssGlcZa14FWlYTQ03NC9Us ++qjR8vlkJh9TvNzbjG6Qw2ZF5xk61feI1xKHd2L5A9htX0E84zjQpf346OekE/rZBS8 dgxoWJye4Ymj/zDrmto1664AXKN/mEfYrYilrnEyVaRf0cXvdO5FMQlU5oSpMhW9HX2d mcsrL02mBhYNth6vfrxANZZsD10/8lxiGpZzL+miBgNuaQVEB7Hj1j4gYt1sqWLt7x7W BbMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature :dkim-signature; bh=RkFPLcPh++w5DR5TbBpD+66MJU5bfppSTijr9WDKBrI=; b=O9fSlNRv4UolQnGxUkJJHgSV+nLb3ok6eviirP3WqLXr09XxYFfiuBqw9sgtwjfmvb wEXv8wSqiB5O6Tt1bUJmlUkYRcwiolYxKqVBhLdUA90HX7Cu59h2eId5X/k9TDqIfWBQ jpLk71yJZKm3k+WGE8slWd+IfflnNQ+mMqKKErMe3Jw3MlCDiwp131jJXsZY2JGLP/nm 5SpCL0KXOMT7QYn602MUCTSiVcXgo/FQw8C+Yi97M0iGqjYupY5jpFIcdVShMigmppeB eGsi8+qxr3kja10TSJ4JMPOb1ObKyYc4cxdyvDl5F7sEBhC1TszKSLE/ia8y5s44N2QY W++A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=dcsQxIkQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=dcsQxIkQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k19si30688759pgn.20.2019.01.11.00.23.22; Fri, 11 Jan 2019 00:23:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=dcsQxIkQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=dcsQxIkQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729272AbfAKGCZ (ORCPT + 99 others); Fri, 11 Jan 2019 01:02:25 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:47408 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727846AbfAKGCZ (ORCPT ); Fri, 11 Jan 2019 01:02:25 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7773C608CC; Fri, 11 Jan 2019 06:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547186544; bh=SH94WpQExnUoO5RLz6hLFLfFG8ZQRAV8pjzksEY8rT0=; h=From:To:Cc:Subject:Date:From; b=dcsQxIkQ1X7ZgIRC6SCH1Xxvo9RcKSg1YnVj5JzMf+kuKKFC6g5faXbe8GFpDW+EV +8sggYHZTsS8oiBgfdWY+OsaT2Rr2P6YmPQScAXWYzzKLIScYUdpqlO19RW48RImHk I7qVtjFW83s1/KCKi7C9r/KrcqYmjGrmJl3nPdnI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mgautam-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 03764601B4; Fri, 11 Jan 2019 06:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547186544; bh=SH94WpQExnUoO5RLz6hLFLfFG8ZQRAV8pjzksEY8rT0=; h=From:To:Cc:Subject:Date:From; b=dcsQxIkQ1X7ZgIRC6SCH1Xxvo9RcKSg1YnVj5JzMf+kuKKFC6g5faXbe8GFpDW+EV +8sggYHZTsS8oiBgfdWY+OsaT2Rr2P6YmPQScAXWYzzKLIScYUdpqlO19RW48RImHk I7qVtjFW83s1/KCKi7C9r/KrcqYmjGrmJl3nPdnI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 03764601B4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mgautam@codeaurora.org From: Manu Gautam To: Felipe Balbi Cc: linux-arm-msm@vger.kernel.org, Manu Gautam , Greg Kroah-Hartman , linux-usb@vger.kernel.org (open list:DESIGNWARE USB3 DRD IP DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] usb: dwc3: gadget: Fail request submission if it was already queued Date: Fri, 11 Jan 2019 11:32:12 +0530 Message-Id: <20190111060212.7390-1-mgautam@codeaurora.org> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a function driver tries to re-submit an already queued request, it can results in corruption of pending/started request lists. Catch such conditions and fail the request submission to DCD. Signed-off-by: Manu Gautam --- drivers/usb/dwc3/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 679c12e14522..51716c6b286a 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1290,6 +1290,12 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) &req->request, req->dep->name)) return -EINVAL; + if (req->request.status == -EINPROGRESS) { + dev_err(dwc->dev, "%s: %pK request already in queue\n", + dep->name, req); + return -EBUSY; + } + pm_runtime_get(dwc->dev); req->request.actual = 0; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project