All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sascha Grunert <sgrunert@redhat.com>
Cc: linux-usb@vger.kernel.org, valentina.manea.m@gmail.com,
	shuah@kernel.org, i@zenithal.me, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] usbip: block SET_INTERFACE for isoc alt settings
Date: Wed, 1 Jul 2026 12:25:40 +0200	[thread overview]
Message-ID: <2026070107-estrogen-semantic-31a4@gregkh> (raw)
In-Reply-To: <20260701101826.894848-3-sgrunert@redhat.com>

On Wed, Jul 01, 2026 at 12:18:26PM +0200, Sascha Grunert wrote:
> USB/IP cannot forward isochronous transfers. When the client activates
> an alt setting with isoc endpoints, the transfers fail with -EPROTO and
> the resulting usb_clear_halt cascade disconnects the device.
> 
> Intercept SET_INTERFACE in tweak_set_interface_cmd() and fake success
> when the target alt setting contains isoc endpoints, keeping the device
> at alt 0.
> 
> Tested with a Turtle Beach Velocity One Flight yoke (10f5:7001)
> forwarded to a VM via USB/IP, which previously disconnect-looped every
> few seconds and now stays connected.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Sascha Grunert <sgrunert@redhat.com>

What commit id does this fix?

> ---
>  drivers/usb/usbip/stub_rx.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c
> index d0e3d3f..f323b48 100644
> --- a/drivers/usb/usbip/stub_rx.c
> +++ b/drivers/usb/usbip/stub_rx.c
> @@ -100,6 +100,28 @@ static int tweak_clear_halt_cmd(struct urb *urb)
>  	return ret;
>  }
>  
> +static bool altsetting_has_isoc(struct usb_device *udev, __u16 interface,
> +				__u16 alternate)
> +{
> +	struct usb_interface *intf;
> +	struct usb_host_interface *alt;
> +	int i;
> +
> +	intf = usb_ifnum_to_if(udev, interface);
> +	if (!intf)
> +		return false;
> +
> +	alt = usb_altnum_to_altsetting(intf, alternate);
> +	if (!alt)
> +		return false;
> +
> +	for (i = 0; i < alt->desc.bNumEndpoints; i++) {
> +		if (usb_endpoint_xfer_isoc(&alt->endpoint[i].desc))
> +			return true;
> +	}
> +	return false;
> +}
> +
>  static int tweak_set_interface_cmd(struct urb *urb)
>  {
>  	struct usb_ctrlrequest *req;
> @@ -111,6 +133,20 @@ static int tweak_set_interface_cmd(struct urb *urb)
>  	alternate = le16_to_cpu(req->wValue);
>  	interface = le16_to_cpu(req->wIndex);
>  
> +	/*
> +	 * USB/IP cannot forward isochronous transfers.  If the requested
> +	 * alt setting activates isochronous endpoints, pretend the switch
> +	 * succeeded without touching the device.  This prevents the
> +	 * cascade of failed isoc URBs that leads to a device disconnect.
> +	 */
> +	if (alternate != 0 && altsetting_has_isoc(urb->dev, interface,
> +						  alternate)) {
> +		dev_info(&urb->dev->dev,
> +			 "usb_set_interface blocked: inf %u alt %u (isoc)\n",
> +			 interface, alternate);

Why is this not an error?  And if a user sees this, what can they do
about it?

> +		return 0;

Why isn't this an error?

thanks,

greg k-h

  reply	other threads:[~2026-07-01 10:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 10:18 [PATCH 0/2] usbip: fix device disconnect loop with isoc endpoints Sascha Grunert
2026-07-01 10:18 ` [PATCH 1/2] usbip: drain remaining PDU payload on rejected endpoint Sascha Grunert
2026-07-01 10:18 ` [PATCH 2/2] usbip: block SET_INTERFACE for isoc alt settings Sascha Grunert
2026-07-01 10:25   ` Greg KH [this message]
2026-07-01 12:06     ` Sascha Grunert

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=2026070107-estrogen-semantic-31a4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sgrunert@redhat.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.