[PATCH] usb: dwc3: fix EP_BUSY in case of dequeue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To reproduce the issue:

-- Gadget dequeues all submitted requests to the endpoint.
-- Some of them was not even queued to the dwc3 core.
-- Such requests will never complete and a transfer completion interrupt
for them will never be received.
-- In such situation, we will not be clearing DWC3_EP_BUSY flag, even
when there is no request queued to dwc3 core.
-- Now gadget queues a request to the one endpoint say (BULK IN)
-- It is added into dep->request_list
-- Host sends an IN token
-- Core responds with NAK and generates xfernotready
-- Since DWC3_EP_BUSY is still set, so this request will never reach to
core (dep->req_queued)

This patch clears DWC3_EP_BUSY during ep_dequeue if none of the request
was in dep->req_queued.

Reported-by: Eric Tomio <eric.tomio@xxxxxx>
Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx>
---
 drivers/usb/dwc3/gadget.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c8f0765..0acf1a1 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1219,6 +1219,8 @@ out1:
 	/* giveback the request */
 	dwc3_gadget_giveback(dep, req, -ECONNRESET);
 
+	if (list_empty(&dep->req_queued))
+		dep->flags &= ~DWC3_EP_BUSY;
 out0:
 	spin_unlock_irqrestore(&dwc->lock, flags);
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux