aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDu, Changbin <changbin.du@intel.com>2016-01-18 08:02:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-25 00:06:21 -0500
commitd8f00cd685f5c8e0def8593e520a7fef12c22407 (patch)
tree5b6460db62b150678d1e7aab762ca40c2f041e1e
parente912e685f372ab62a2405a1acd923597f524e94a (diff)
usb: hub: do not clear BOS field during reset device
In function usb_reset_and_verify_device, the old BOS descriptor may still be used before allocating a new one. (usb_unlocked_disable_lpm function uses it under the situation that it fails to disable lpm.) So we cannot set the udev->bos to NULL before that, just keep what it was. It will be overwrite when allocating a new one. Crash log: BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: [<ffffffff8171f98d>] usb_enable_link_state+0x2d/0x2f0 Call Trace: [<ffffffff8171ed5b>] ? usb_set_lpm_timeout+0x12b/0x140 [<ffffffff8171fcd1>] usb_enable_lpm+0x81/0xa0 [<ffffffff8171fdd8>] usb_disable_lpm+0xa8/0xc0 [<ffffffff8171fe1c>] usb_unlocked_disable_lpm+0x2c/0x50 [<ffffffff81723933>] usb_reset_and_verify_device+0xc3/0x710 [<ffffffff8172c4ed>] ? usb_sg_wait+0x13d/0x190 [<ffffffff81724743>] usb_reset_device+0x133/0x280 [<ffffffff8179ccd1>] usb_stor_port_reset+0x61/0x70 [<ffffffff8179cd68>] usb_stor_invoke_transport+0x88/0x520 Signed-off-by: Du, Changbin <changbin.du@intel.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/core/hub.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 51b436918f78..350dcd9af5d8 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5401,7 +5401,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
5401 } 5401 }
5402 5402
5403 bos = udev->bos; 5403 bos = udev->bos;
5404 udev->bos = NULL;
5405 5404
5406 for (i = 0; i < SET_CONFIG_TRIES; ++i) { 5405 for (i = 0; i < SET_CONFIG_TRIES; ++i) {
5407 5406
@@ -5494,8 +5493,11 @@ done:
5494 usb_set_usb2_hardware_lpm(udev, 1); 5493 usb_set_usb2_hardware_lpm(udev, 1);
5495 usb_unlocked_enable_lpm(udev); 5494 usb_unlocked_enable_lpm(udev);
5496 usb_enable_ltm(udev); 5495 usb_enable_ltm(udev);
5497 usb_release_bos_descriptor(udev); 5496 /* release the new BOS descriptor allocated by hub_port_init() */
5498 udev->bos = bos; 5497 if (udev->bos != bos) {
5498 usb_release_bos_descriptor(udev);
5499 udev->bos = bos;
5500 }
5499 return 0; 5501 return 0;
5500 5502
5501re_enumerate: 5503re_enumerate: