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: USB Denial Of Service
Date: Wed, 12 Jun 2024 11:55:58 +0200 [thread overview]
Message-ID: <2024061228-cameo-mosaic-cea7@gregkh> (raw)
In-Reply-To: <a09c0dfc-1cdc-445b-a524-305c3f5f3d79@rowland.harvard.edu>
On Tue, Jun 11, 2024 at 03:09:32PM -0400, Alan Stern wrote:
> On Tue, Jun 11, 2024 at 10:35:12AM -0400, Alan Stern wrote:
> > Greg, Oliver, or anyone else:
> >
> > Questions:
> >
> > If a broken or malicious device causes a USB class driver to add a
> > thousand (or more) error messages per second to the kernel log,
> > indefinitely, would that be considered a form of DOS?
> >
> > Should the driver be fixed?
> >
> > What is an acceptable rate for an unending stream of error messages?
> > Once a second? Once a minute?
> >
> > At what point should the driver give up and stop trying to communicate
> > with the device?
> >
> > (These are not moot questions. There are indeed drivers, and probably
> > not just in the USB subsystem, subject to this sort of behavior.)
>
> Along those lines, what do you think of the following patch for handling
> -EPROTO, -EILSEQ, or -ETIME status values for the interrupt URB in the
> cdc-wdm driver? After one of those errors, the URB is immediately
> resubmitted, so the error is likely to occur again no more than a
> millisecond later. Changing dev_err() to dev_dbg() prevents log
> spamming.
>
> Alternatively, the driver could avoid resubmitting the URB when one of
> those errors occurs. This is perhaps less appropriate, because these
> kinds of errors can be transient (although that is normally rare).
>
> Alan Stern
>
>
>
> Index: usb-devel/drivers/usb/class/cdc-wdm.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/class/cdc-wdm.c
> +++ usb-devel/drivers/usb/class/cdc-wdm.c
> @@ -266,14 +266,14 @@ static void wdm_int_callback(struct urb
> dev_err(&desc->intf->dev, "Stall on int endpoint\n");
> goto sw; /* halt is cleared in work */
> default:
> - dev_err(&desc->intf->dev,
> + dev_dbg(&desc->intf->dev,
> "nonzero urb status received: %d\n", status);
dev_err_ratelimited() maybe instead?
> break;
> }
> }
>
> if (urb->actual_length < sizeof(struct usb_cdc_notification)) {
> - dev_err(&desc->intf->dev, "wdm_int_callback - %d bytes\n",
> + dev_dbg(&desc->intf->dev, "wdm_int_callback - %d bytes\n",
Same here?
thanks,
greg k-h
next prev parent reply other threads:[~2024-06-12 9:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 14:35 USB Denial Of Service Alan Stern
2024-06-11 19:09 ` Alan Stern
2024-06-12 7:43 ` Oliver Neukum
2024-06-12 9:55 ` Greg KH [this message]
2024-06-12 8:00 ` Oliver Neukum
2024-06-12 9:55 ` Greg KH
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=2024061228-cameo-mosaic-cea7@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