Skip to content

Commit

Permalink
Revert "usb: hub: do not clear BOS field during reset device"
Browse files Browse the repository at this point in the history
This reverts commit d8f00cd.

Tony writes:

This upstream commit is causing an oops:
d8f00cd ("usb: hub: do not clear BOS field during reset device")

This patch has already been included in several -stable kernels.  Here
are the affected kernels:
4.5.0-rc4 (current git)
4.4.2
4.3.6 (currently in review)
4.1.18
3.18.27
3.14.61

How to reproduce the problem:
Boot kernel with slub debugging enabled (otherwise memory corruption
will cause random oopses later instead of immediately)
Plug in USB 3.0 disk to xhci USB 3.0 port
dd if=/dev/sdc of=/dev/null bs=65536
(where /dev/sdc is the USB 3.0 disk)
Unplug USB cable while dd is still going
Oops is immediate:

Reported-by: Tony Battersby <tonyb@cybernetics.com>
Cc: Du, Changbin <changbin.du@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
gregkh committed Feb 20, 2016
1 parent f9a96d2 commit e5bdfd5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5401,6 +5401,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
}

bos = udev->bos;
udev->bos = NULL;

for (i = 0; i < SET_CONFIG_TRIES; ++i) {

Expand Down Expand Up @@ -5493,11 +5494,8 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
usb_set_usb2_hardware_lpm(udev, 1);
usb_unlocked_enable_lpm(udev);
usb_enable_ltm(udev);
/* release the new BOS descriptor allocated by hub_port_init() */
if (udev->bos != bos) {
usb_release_bos_descriptor(udev);
udev->bos = bos;
}
usb_release_bos_descriptor(udev);
udev->bos = bos;
return 0;

re_enumerate:
Expand Down

0 comments on commit e5bdfd5

Please sign in to comment.