summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorVijayavardhan Vennapusa <vvreddy@codeaurora.org>2016-11-18 16:09:12 -0800
committerMayank Rana <mrana@codeaurora.org>2016-11-18 16:09:57 -0800
commitbeafbd43d59433b8ed5f4fb330a826239ff46f18 (patch)
treef94b3840476813436992a4638a8cd37368141fb0 /drivers/usb
parent42939d068531e7c2a10e5d8f13e51c2f77c8bf16 (diff)
USB: gagget: f_fs: Return error if TX req is queued during device offline
when USB cable is disconnected during TX data transfers, endpoints will be disabled during function disable. If userspace client tries to queue requests on disabled endpoints, driver will wait till endpoints are enabled and then queues previous session requests. This results in kernel driver and userspace driver out of sync and due to this, stall will be seen. Hence fix this issue by returning error value if client tries to queue requests on TX endpoint during device offline. CRs-Fixed: 633497 Change-Id: I3e43b8a704367aff7fe8dd88159315aef811c51c Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_fs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index eb2409dda50d..19d6a997ee6c 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -760,8 +760,8 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
ssize_t ret, data_len = -EINVAL;
int halt;
- ffs_log("enter: epfile name %s epfile err %d", epfile->name,
- atomic_read(&epfile->error));
+ ffs_log("enter: epfile name %s epfile err %d (%s)", epfile->name,
+ atomic_read(&epfile->error), io_data->read ? "READ" : "WRITE");
smp_mb__before_atomic();
if (atomic_read(&epfile->error))
@@ -781,6 +781,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
goto error;
}
+ /* Don't wait on write if device is offline */
+ if (!io_data->read) {
+ ret = -EINTR;
+ goto error;
+ }
+
/*
* If ep is disabled, this fails all current IOs
* and wait for next epfile open to happen.