patch "USB: hub: fix SS hub-descriptor handling" added to usb-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
USB: hub: fix SS hub-descriptor handling
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
2c25a2c818023df64463aac3288a9f969491e507Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 10 May 2017 18:18:27 +0200
Subject: USB: hub: fix SS hub-descriptor handling
A SuperSpeed hub descriptor does not have any variable-length fields so bail out when reading a short descriptor.
This avoids parsing and leaking two bytes of uninitialised slab data through sysfs removable-attributes.
--- drivers/usb/core/hub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +6 -2
@@ -380,8 +380,12 @@ static int get_hub_descriptor(struct usb_device *hdev, void *data)USB_REQ_GET_DESCRIPTOR ,USB_DIR_IN |USB_RT_HUB , dtype <<8 ,0 , data, size, USB_CTRL_GET_TIMEOUT); -if (ret >= (USB_DT_HUB_NONVAR_SIZE +2 )) +if (hub_is_superspeed (hdev)) { +if (ret == size) +return ret; + }else if (ret >= (USB_DT_HUB_NONVAR_SIZE +2 )) {return ret; + } }return -EINVAL ; }
@@ -1321,7 +1325,7 @@ static int hub_configure(struct usb_hub *hub,/* Request the entire hub descriptor. * hub->descriptor can handle USB_MAXCHILDREN ports, -* but the hub can/will return fewer bytes here. +* but a (non-SS) hub can/will return fewer bytes here. */ ret =get_hub_descriptor (hdev, hub->descriptor);if (ret <0 ) {
Signature · 1 line
2.13.0