All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree
@ 2017-06-17 18:18 gregkh
  2017-06-22 16:23 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2017-06-17 18:18 UTC (permalink / raw)
  To: johan, gregkh, hirofuchi, shuahkh, valentina.manea.m; +Cc: stable


The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From ec963b412a54aac8e527708ecad06a6988a86fb4 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Wed, 10 May 2017 18:18:26 +0200
Subject: [PATCH] USB: usbip: fix nonconforming hub descriptor

Fix up the root-hub descriptor to accommodate the variable-length
DeviceRemovable and PortPwrCtrlMask fields, while marking all ports as
removable (and leaving the reserved bit zero unset).

Also add a build-time constraint on VHCI_HC_PORTS which must never be
greater than USB_MAXCHILDREN (but this was only enforced through a
KConfig constant).

This specifically fixes the descriptor layout whenever VHCI_HC_PORTS is
greater than seven (default is 8).

Fixes: 04679b3489e0 ("Staging: USB/IP: add client driver")
Cc: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>
Cc: Valentina Manea <valentina.manea.m@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 5d8b2c261940..0585078638db 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -235,14 +235,19 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)
 
 static inline void hub_descriptor(struct usb_hub_descriptor *desc)
 {
+	int width;
+
 	memset(desc, 0, sizeof(*desc));
 	desc->bDescriptorType = USB_DT_HUB;
-	desc->bDescLength = 9;
 	desc->wHubCharacteristics = cpu_to_le16(
 		HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM);
+
 	desc->bNbrPorts = VHCI_HC_PORTS;
-	desc->u.hs.DeviceRemovable[0] = 0xff;
-	desc->u.hs.DeviceRemovable[1] = 0xff;
+	BUILD_BUG_ON(VHCI_HC_PORTS > USB_MAXCHILDREN);
+	width = desc->bNbrPorts / 8 + 1;
+	desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width;
+	memset(&desc->u.hs.DeviceRemovable[0], 0, width);
+	memset(&desc->u.hs.DeviceRemovable[width], 0xff, width);
 }
 
 static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree
  2017-06-17 18:18 FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree gregkh
@ 2017-06-22 16:23 ` Shuah Khan
  2017-06-26  8:00   ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2017-06-22 16:23 UTC (permalink / raw)
  To: gregkh, johan, hirofuchi, valentina.manea.m
  Cc: stable, Shuah Khan, Shuah Khan

Hi Johan,

On 06/17/2017 12:18 PM, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 4.4-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
> 
> thanks,
> 
> greg k-h

Will you be able to backport and send in a patch for 4.4-stable tree?
If not, please let me know, I can take care of it.

thanks,
-- Shuah

> 
> ------------------ original commit in Linus's tree ------------------
> 
> From ec963b412a54aac8e527708ecad06a6988a86fb4 Mon Sep 17 00:00:00 2001
> From: Johan Hovold <johan@kernel.org>
> Date: Wed, 10 May 2017 18:18:26 +0200
> Subject: [PATCH] USB: usbip: fix nonconforming hub descriptor
> 
> Fix up the root-hub descriptor to accommodate the variable-length
> DeviceRemovable and PortPwrCtrlMask fields, while marking all ports as
> removable (and leaving the reserved bit zero unset).
> 
> Also add a build-time constraint on VHCI_HC_PORTS which must never be
> greater than USB_MAXCHILDREN (but this was only enforced through a
> KConfig constant).
> 
> This specifically fixes the descriptor layout whenever VHCI_HC_PORTS is
> greater than seven (default is 8).
> 
> Fixes: 04679b3489e0 ("Staging: USB/IP: add client driver")
> Cc: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>
> Cc: Valentina Manea <valentina.manea.m@gmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> index 5d8b2c261940..0585078638db 100644
> --- a/drivers/usb/usbip/vhci_hcd.c
> +++ b/drivers/usb/usbip/vhci_hcd.c
> @@ -235,14 +235,19 @@ static int vhci_hub_status(struct usb_hcd *hcd, char *buf)
>  
>  static inline void hub_descriptor(struct usb_hub_descriptor *desc)
>  {
> +	int width;
> +
>  	memset(desc, 0, sizeof(*desc));
>  	desc->bDescriptorType = USB_DT_HUB;
> -	desc->bDescLength = 9;
>  	desc->wHubCharacteristics = cpu_to_le16(
>  		HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM);
> +
>  	desc->bNbrPorts = VHCI_HC_PORTS;
> -	desc->u.hs.DeviceRemovable[0] = 0xff;
> -	desc->u.hs.DeviceRemovable[1] = 0xff;
> +	BUILD_BUG_ON(VHCI_HC_PORTS > USB_MAXCHILDREN);
> +	width = desc->bNbrPorts / 8 + 1;
> +	desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width;
> +	memset(&desc->u.hs.DeviceRemovable[0], 0, width);
> +	memset(&desc->u.hs.DeviceRemovable[width], 0xff, width);
>  }
>  
>  static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree
  2017-06-22 16:23 ` Shuah Khan
@ 2017-06-26  8:00   ` Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2017-06-26  8:00 UTC (permalink / raw)
  To: Shuah Khan
  Cc: gregkh, johan, hirofuchi, valentina.manea.m, stable, Shuah Khan

On Thu, Jun 22, 2017 at 10:23:17AM -0600, Shuah Khan wrote:
> Hi Johan,
> 
> On 06/17/2017 12:18 PM, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.4-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Will you be able to backport and send in a patch for 4.4-stable tree?
> If not, please let me know, I can take care of it.

I just submitted a backport to 4.4 (which uses VHCI_NPORTS rather
than VHCI_HC_PORTS).

Thanks,
Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-26  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-17 18:18 FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree gregkh
2017-06-22 16:23 ` Shuah Khan
2017-06-26  8:00   ` Johan Hovold

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.