Re: [PATCH] USB: yurex: fix control-URB timeout handling
From: Johan Hovold
Date: Mon Dec 14 2020 - 05:52:09 EST
On Mon, Dec 14, 2020 at 11:44:44AM +0100, Johan Hovold wrote:
> 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@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 6bc235a2e24a ("USB: add driver for Meywa-Denki & Kayac YUREX")
> Cc: stable <stable@xxxxxxxxxxxxxxx> # 2.6.37
> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
> ---
Forgot linux-usb...
Let's try this too:
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> drivers/usb/misc/yurex.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
> index 73ebfa6e9715..c640f98d20c5 100644
> --- a/drivers/usb/misc/yurex.c
> +++ b/drivers/usb/misc/yurex.c
> @@ -496,6 +496,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) {