FAILED: patch "[PATCH] USB: usbip: fix nonconforming hub descriptor" failed to apply to 4.4-stable tree
Subsystems (3)
[email protected]
maintainerThe 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 <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
ec963b412a54aac8e527708ecad06a6988a86fb4Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
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).
drivers/usb/usbip/vhci_hcd.c +8 -3
@@ -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,
Hi Johan,
Quoted 9 lines · On 06/17/2017 12:18 PM, [email protected] 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 <[email protected]>.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
Quoted 54 lines
------------------ original commit in Linus's tree ------------------
From
ec963b412a54aac8e527708ecad06a6988a86fb4Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 10 May 2017 18:18:26 +0200
Subject: [PATCH] USB: usbip: fix nonconforming hub descriptorFix 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_PORTSwhich must never be greater thanUSB_MAXCHILDREN(but this was only enforced through a KConfig constant).This specifically fixes the descriptor layout whenever
VHCI_HC_PORTSis greater than seven (default is 8).Fixes 04679b3489e0 ("Staging: USB/IP: add client driver")Cc Takahiro Hirofuchi <[email protected]>Cc Valentina Manea <[email protected]>Signed-off-by Johan Hovold <[email protected]>Acked-by Shuah Khan <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>drivers/usb/usbip/vhci_hcd.c +8
-3@@ -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,
Quoted 9 lines · Shuah Khan
Hi Johan,
Quoted 6 lines · On 06/17/2017 12:18 PM, [email protected] 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 <[email protected]>.
Quoted 6 lines
Quoted 3 lines
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