Re: [syzbot] [usb?] INFO: task hung in usb_bulk_msg (2)
From: Alan Stern
Date: Mon Feb 09 2026 - 11:36:45 EST
On Sun, Feb 08, 2026 at 05:46:03PM -0800, syzbot wrote:
> Hello,
>
> syzbot has tested the proposed patch and the reproducer did not trigger any issue:
>
> Reported-by: syzbot+25ba18e2c5040447585d@xxxxxxxxxxxxxxxxxxxxxxxxx
> Tested-by: syzbot+25ba18e2c5040447585d@xxxxxxxxxxxxxxxxxxxxxxxxx
Here's another, more local, solution. It should fix this bug but not
the underlying problem.
Alan Stern
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git da87d45b1951
Index: usb-devel/drivers/usb/class/usbtmc.c
===================================================================
--- usb-devel.orig/drivers/usb/class/usbtmc.c
+++ usb-devel/drivers/usb/class/usbtmc.c
@@ -34,6 +34,8 @@
#define USBTMC_MIN_TIMEOUT 100
/* Default USB timeout (in milliseconds) */
#define USBTMC_TIMEOUT 5000
+/* Maximum USB timeout (in milliseconds) */
+#define USBTMC_MAX_TIMEOUT 60000
/* Max number of urbs used in write transfers */
#define MAX_URBS_IN_FLIGHT 16
@@ -2014,10 +2016,11 @@ static int usbtmc_ioctl_set_timeout(stru
if (get_user(timeout, (__u32 __user *)arg))
return -EFAULT;
- /* Note that timeout = 0 means
- * MAX_SCHEDULE_TIMEOUT in usb_control_msg
+ /*
+ * Impose a maximum limit to timeouts because the waits in
+ * usb_control_msg and usb_bulk_msg are uninterruptible.
*/
- if (timeout < USBTMC_MIN_TIMEOUT)
+ if (timeout < USBTMC_MIN_TIMEOUT || timeout > USBTMC_MAX_TIMEOUT)
return -EINVAL;
file_data->timeout = timeout;