From: Greg KH <gregkh@linuxfoundation.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oneukum@suse.com>,
USB mailing list <linux-usb@vger.kernel.org>
Subject: Re: RFC: Prevent long uninterruptible waits in usbcore
Date: Mon, 9 Feb 2026 11:05:45 +0100 [thread overview]
Message-ID: <2026020950-prodigy-steadier-f747@gregkh> (raw)
In-Reply-To: <3acfe838-6334-4f6d-be7c-4bb01704b33d@rowland.harvard.edu>
On Sun, Feb 08, 2026 at 09:33:02PM -0500, Alan Stern wrote:
> I'm asking for comments on the patch below. The problem it fixes is
> that usb_start_wait_urb(), which is used by utility routines like
> usb_bulk_msg() and usb_control_msg(), can have arbitrarily long
> uninterruptible waits. And of course this can trigger the kernel's
> warning about a hung task.
>
> Normally this isn't a problem, because drivers calling these routines
> generally specify timeouts on the order of 10 seconds or less. In the
> particular case found by syzbot, however, the usbtmc driver uses a
> timeout value that it gets from an ioctl with no checking for
> excessively large numbers (see usbtmc_ioctl_set_timeout()). We could
> change this one function, but what about other drivers? There should be
> a single policy on how we handle these things.
>
> Now, I suppose the reason that the usb_start_wait_urb() uses
> uninterruptible waits is that drivers don't want their calls to be
> interrupted and aren't prepared for that possibility. But we also don't
> want them to tie up a kernel thread in a ridiculously long
> uninterruptible wait state.
>
> I thought that a reasonable compromise would be to keep the
> uninterruptible waits for timeout periods less than 60 seconds (somewhat
> arbitrary, but hopefully short enough not to trigger the hung-task
> detector) and make them interruptible if the timeout is longer. The
> idea is that long USB timeouts don't normally arise in the kernel, so
> they are probably caused by a user request (or a bad device), which
> would mean that interrupting them wouldn't be such a bad thing.
>
> Any other ideas or thoughts about this?
Having an upper-bound on this is a good idea, and also the usbtmc driver
should also be fixed to just reject extra-long delays in that ioctl as
that's a user-visable way to stall a cpu.
So no objection from me with this patch.
thanks,
greg k-h
next prev parent reply other threads:[~2026-02-09 10:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 2:33 RFC: Prevent long uninterruptible waits in usbcore Alan Stern
2026-02-09 10:05 ` Greg KH [this message]
2026-02-09 15:16 ` Alan Stern
2026-02-09 15:39 ` Oliver Neukum
2026-02-09 19:59 ` [PATCH 1/2] usbcore: Reject excessively long uninterruptible timeouts Alan Stern
2026-02-09 20:00 ` [PATCH 2/2] USB: usbtmc: Don't accept very long timeouts Alan Stern
2026-02-10 9:03 ` Oliver Neukum
2026-02-11 3:25 ` Alan Stern
2026-02-11 10:28 ` Oliver Neukum
2026-02-11 15:31 ` Alan Stern
2026-02-11 15:59 ` Oliver Neukum
2026-02-11 16:18 ` Alan Stern
2026-02-11 17:59 ` Oliver Neukum
2026-02-12 2:34 ` Alan Stern
2026-02-12 8:13 ` Oliver Neukum
2026-02-10 8:51 ` [PATCH 1/2] usbcore: Reject excessively long uninterruptible timeouts Oliver Neukum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026020950-prodigy-steadier-f747@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox