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

Commit 2b92dcea authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Mayank Rana
Browse files

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: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent f9dc762f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -939,7 +939,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->name);
	ffs_log("enter: epfile name %s (%s)", epfile->name,
				io_data->read ? "READ" : "WRITE");

	/* Are we still active? */
	if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
@@ -951,6 +952,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
		if (file->f_flags & O_NONBLOCK)
			return -EAGAIN;

		/* Don't wait on write if device is offline */
		if (!io_data->read)
			return -EINTR;

		ret = wait_event_interruptible(epfile->wait, (ep = epfile->ep));
		if (ret)
			return -EINTR;