summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorManu Gautam <mgautam@codeaurora.org>2013-02-11 15:53:34 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:06:13 -0700
commit5ffe965cf49f1a89d5f9e01ccb949efebfa9f4d8 (patch)
treed09cf16491f01747a4dcdaa31d8efd6d903ee283 /drivers/usb
parent0e58b939fb33bc32f855e4e196d11f0fe1733a8b (diff)
usb: dwc3: gadget: Fail request submission if it was already queued
Function driver should not try to queue a busy request again to DCD until DCD returns it by calling its completion handler or it is explicitly dequeued. Some buggy function driver may try to submit a request again which is with DCD resulting in corruption of request_list leading to crash later in giveback. Catch such conditions and fail the request submission to DCD. CRs-Fixed: 447192 Change-Id: Id2a4a1720f61dffc50cc22598734f229caf07ff3 Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/gadget.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 35905a26d712..bd5f3d3a6b6e 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1051,6 +1051,13 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
struct dwc3 *dwc = dep->dwc;
int ret;
+ if (req->request.status == -EINPROGRESS) {
+ ret = -EBUSY;
+ dev_err(dwc->dev, "%s: %p request already in queue",
+ dep->name, req);
+ return ret;
+ }
+
req->request.actual = 0;
req->request.status = -EINPROGRESS;
req->direction = dep->direction;