提交 e0dcf1e1 编写于 作者: J Johan Hovold 提交者: Zheng Zengkai

USB: yurex: fix control-URB timeout handling

stable inclusion
from stable-5.10.7
commit 4f7e97ffb4eb6413799f80a7af8595db534bec45
bugzilla: 47429

--------------------------------

commit 372c9313 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: 6bc235a2 ("USB: add driver for Meywa-Denki & Kayac YUREX")
Cc: stable <stable@vger.kernel.org>     # 2.6.37
Signed-off-by: NJohan Hovold <johan@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 1fa98fc0
......@@ -495,6 +495,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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册