summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorVijayavardhan Vennapusa <vvreddy@codeaurora.org>2016-01-28 10:58:39 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:10:02 -0700
commite822c0fcf5aca104b4ccb3905b2bce21779f370b (patch)
treee41d35a537e8dcfb343f4c0c61cd4cc3cf5200d8 /drivers/usb/gadget
parent55a6f12e78ba2ee1eb3be9f12cc840085f1ea9fc (diff)
USB: f_fs: Check error status before doing epfile I/O
Set error status before disabling endpoint during function disable and also check error status before handling I/O. If error status is set, return error status to read/write calls made by userspace. Also set file's private data to NULL during epfile release. Change-Id: I14b5ee541dfc18a7802ef4a8033878a7729d9adb Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/function/f_fs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index a3862a21db85..449594801f0b 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -690,6 +690,9 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
ssize_t ret, data_len = -EINVAL;
int halt;
+ if (atomic_read(&epfile->error))
+ return -ENODEV;
+
/* Are we still active? */
if (WARN_ON(epfile->ffs->state != FFS_ACTIVE)) {
ret = -ENODEV;
@@ -1014,6 +1017,7 @@ ffs_epfile_release(struct inode *inode, struct file *file)
atomic_set(&epfile->error, 1);
ffs_data_closed(epfile->ffs);
+ file->private_data = NULL;
return 0;
}
@@ -1640,6 +1644,10 @@ static void ffs_func_eps_disable(struct ffs_function *func)
spin_lock_irqsave(&func->ffs->eps_lock, flags);
do {
+
+ if (epfile)
+ atomic_set(&epfile->error, 1);
+
/* pending requests get nuked */
if (likely(ep->ep))
usb_ep_disable(ep->ep);