public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	Oliver Neukum <oneukum@suse.com>,
	Greg KH <gregkh@linuxfoundation.org>
Cc: USB mailing list <linux-usb@vger.kernel.org>
Subject: Re: USB Denial Of Service
Date: Wed, 12 Jun 2024 09:43:55 +0200	[thread overview]
Message-ID: <b3bcf3a1-c0ee-4550-867d-b92c66f564b6@suse.com> (raw)
In-Reply-To: <a09c0dfc-1cdc-445b-a524-305c3f5f3d79@rowland.harvard.edu>

On 11.06.24 21:09, Alan Stern wrote:

> 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).

Optimally we'd wait a small delay and resubmit after that for a limited
number of attempts. In fact optimally we'd add helpers to do so for
all drivers to use.

However, to make this wor with suspend, reset and disconnect would
take work. Is a corner case worth that?

> 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,

Good idea.

>   				"nonzero urb status received: %d\n", status);
>   			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",

Not so good idea. If that happens it points to either a bug in the firmware
or a malicious device. Such things need to be logged.

	Regards
		Oliver


  reply	other threads:[~2024-06-12  7:43 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 [this message]
2024-06-12  9:55   ` Greg KH
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=b3bcf3a1-c0ee-4550-867d-b92c66f564b6@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --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