summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorHemant Kumar <hemantk@codeaurora.org>2016-05-01 22:22:35 -0700
committerKyle Yan <kyan@codeaurora.org>2016-06-07 16:03:05 -0700
commit128668947af53deb0a452e7ea17e76930c741835 (patch)
tree8635acbdc75212dbad3b2c45c0ec6c13589c3338 /drivers/usb
parent3f0f67e02866b1dda6f7a69446490af149ecb60c (diff)
USB: f_mtp: Check if the ep is not disabled before queuing it
Queuing a request on a disabled endpoint during composition switch leads to prime failure. Hence return -EINVAL if a request is queued on a disabled endpoint. Also, in f_mtp, block queuing a request in OUT ep in receive_file_work, if the device state is STATE_OFFLINE. Change-Id: I0e706d5280a2460baf6ab05dbf97a09c59b642fb Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_mtp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c
index 38583b220dd1..3d4f08577751 100644
--- a/drivers/usb/gadget/function/f_mtp.c
+++ b/drivers/usb/gadget/function/f_mtp.c
@@ -862,7 +862,8 @@ static void receive_file_work(struct work_struct *data)
/* wait for our last read to complete */
ret = wait_event_interruptible(dev->read_wq,
dev->rx_done || dev->state != STATE_BUSY);
- if (dev->state == STATE_CANCELED) {
+ if (dev->state == STATE_CANCELED
+ || dev->state == STATE_OFFLINE) {
r = -ECANCELED;
if (!dev->rx_done)
usb_ep_dequeue(dev->ep_out, read_req);