Skip to content

Commit 1be3b77

Browse files
haruki3hhhgregkh
authored andcommitted
usb: image: mdc800: kill download URB on timeout
mdc800_device_read() submits download_urb and waits for completion. If the timeout fires and the device has not responded, the function returns without killing the URB, leaving it active. A subsequent read() resubmits the same URB while it is still in-flight, triggering the WARN in usb_submit_urb(): "URB submitted while active" Check the return value of wait_event_timeout() and kill the URB if it indicates timeout, ensuring the URB is complete before its status is inspected or the URB is resubmitted. Similar to - commit 372c931 ("USB: yurex: fix control-URB timeout handling") - commit b98d500 ("media: rc: iguanair: handle timeouts") Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu> Cc: stable <stable@kernel.org> Link: https://patch.msgid.link/20260209151937.2247202-1-n7l8m4@u.northwestern.edu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2d6d260 commit 1be3b77

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/usb/image/mdc800.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,11 @@ static ssize_t mdc800_device_read (struct file *file, char __user *buf, size_t l
730730
mutex_unlock(&mdc800->io_lock);
731731
return len-left;
732732
}
733-
wait_event_timeout(mdc800->download_wait,
733+
retval = wait_event_timeout(mdc800->download_wait,
734734
mdc800->downloaded,
735735
msecs_to_jiffies(TO_DOWNLOAD_GET_READY));
736+
if (!retval)
737+
usb_kill_urb(mdc800->download_urb);
736738
mdc800->downloaded = 0;
737739
if (mdc800->download_urb->status != 0)
738740
{

0 commit comments

Comments
 (0)