summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-02-19 15:33:17 -0500
committerNitin Garg <nitin.garg@freescale.com>2011-12-15 13:56:18 -0600
commit8cf93794d1bf623f4c4e1137e0e63776b815a1b4 (patch)
tree258b609fc606c808c0ccb63948a6d590b33e2178
parent973d921f784cd10b8c33e8fe04ce821179109a91 (diff)
USB: gadget: f_mtp: dequeue request on error in mtp_read
In mtp_read(), if wait_event_interruptible() returns an error, we need to remove the request from the EP queue. Else, on the next call to mtp_read(), we will attempt to enqueue the request again, potentially corrupting the queue. This is what happens with musb_gadget_queue(), which does not check for duplicate requests. Based on a similar change to f_adb.c Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r--drivers/usb/gadget/f_mtp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_mtp.c b/drivers/usb/gadget/f_mtp.c
index e422bf2fc23c..2af820148e26 100644
--- a/drivers/usb/gadget/f_mtp.c
+++ b/drivers/usb/gadget/f_mtp.c
@@ -501,6 +501,7 @@ requeue_req:
ret = wait_event_interruptible(dev->read_wq, dev->rx_done);
if (ret < 0) {
r = ret;
+ usb_ep_dequeue(dev->ep_out, req);
goto done;
}
if (dev->state == STATE_BUSY) {