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

Commit 49bb1069 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

USB: yurex: fix control-URB timeout handling



commit 372c93131998c0622304bed118322d2a04489e63 upstream.

Make sure to always cancel the control URB in write() so that it can be
reused after a timeout or spurious CMD_ACK.

Currently any further write requests after a timeout would fail after
triggering a WARN() in usb_submit_urb() when attempting to submit the
already active URB.

Reported-by: default avatar <syzbot+e87ebe0f7913f71f2ea5@syzkaller.appspotmail.com>
Fixes: 6bc235a2 ("USB: add driver for Meywa-Denki & Kayac YUREX")
Cc: stable <stable@vger.kernel.org>     # 2.6.37
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f617a85b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -507,6 +507,9 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
		timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
		timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
	finish_wait(&dev->waitq, &wait);
	finish_wait(&dev->waitq, &wait);


	/* make sure URB is idle after timeout or (spurious) CMD_ACK */
	usb_kill_urb(dev->cntl_urb);

	mutex_unlock(&dev->io_mutex);
	mutex_unlock(&dev->io_mutex);


	if (retval < 0) {
	if (retval < 0) {