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 function driver may try to submit a
request again which is with DCD resulting in corruption of request_list
leading to kernel panic later in giveback. Catch such conditions and fail
the request submission to DCD.

Change-Id: Id2a4a1720f61dffc50cc22598734f229caf07ff3
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 43faacf..685ff30 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1482,6 +1482,12 @@
 				&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;
+	}
+
 	req->request.actual	= 0;
 	req->request.status	= -EINPROGRESS;