Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ed8bf3c authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

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.

CRs-Fixed: 671880
Change-Id: I14b5ee541dfc18a7802ef4a8033878a7729d9adb
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 60d75479
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -769,6 +769,9 @@ static ssize_t ffs_epfile_io(struct file *file,

	pr_debug("%s: len %zu, read %d\n", __func__, len, read);

	if (atomic_read(&epfile->error))
		return -ENODEV;

	goto first_try;
	do {
		spin_unlock_irq(&epfile->ffs->eps_lock);
@@ -945,6 +948,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;
}
@@ -1586,12 +1590,12 @@ static void ffs_func_eps_disable(struct ffs_function *func)

	spin_lock_irqsave(&func->ffs->eps_lock, flags);
	do {
		atomic_set(&epfile->error, 1);
		/* pending requests get nuked */
		if (likely(ep->ep)) {
			usb_ep_disable(ep->ep);
			ep->ep->driver_data = NULL;
		}
		atomic_set(&epfile->error, 1);
		epfile->ep = NULL;

		++ep;