Skip to content

Commit

Permalink
USB: yurex: fix control-URB timeout handling
Browse files Browse the repository at this point in the history
commit 372c931 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: syzbot+e87ebe0f7913f71f2ea5@syzkaller.appspotmail.com
Fixes: 6bc235a ("USB: add driver for Meywa-Denki & Kayac YUREX")
Cc: stable <stable@vger.kernel.org>     # 2.6.37
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jhovold authored and gregkh committed Jan 12, 2021
1 parent 175f7a5 commit 41f15da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/misc/yurex.c
Expand Up @@ -497,6 +497,9 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
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);

if (retval < 0) {
Expand Down

0 comments on commit 41f15da

Please sign in to comment.