Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1311538
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | changbin.du@intel.com |
| Newsgroups | linux.kernel |
| Subject | [PATCH] usb: hub: do not clear BOS field during reset device |
| Date | Mon, 18 Jan 2016 14:20:02 +0100 |
| Message-ID | <qShSW-179-15@gated-at.bofh.it> (permalink) |
| X-Original-To | gregkh@linuxfoundation.org |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.22,312,1449561600"; d="scan'208";a="863047466" |
| X-Mailer | git-send-email 2.5.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 56 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | stern@rowland.harvard.edum, baolu.lu@linux.intel.com, balbi@ti.com, chasemetzger15@gmail.com, kborer@gmail.com, mjg59@coreos.com, jun.li@freescale.com, Robert.Schlabbach@gmx.net, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Du, Changbin" <changbin.du@intel.com> |
| X-Original-Date | Mon, 18 Jan 2016 21:02:42 +0800 |
| X-Original-Message-ID | <1453122162-5054-1-git-send-email-changbin.du@intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1311538 |
Show key headers only | View raw
From: "Du, Changbin" <changbin.du@intel.com>
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>
---
drivers/usb/core/hub.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 51b43691..350dcd9 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)
}
bos = udev->bos;
- udev->bos = NULL;
for (i = 0; i < SET_CONFIG_TRIES; ++i) {
@@ -5494,8 +5493,11 @@ done:
usb_set_usb2_hardware_lpm(udev, 1);
usb_unlocked_enable_lpm(udev);
usb_enable_ltm(udev);
- usb_release_bos_descriptor(udev);
- udev->bos = bos;
+ /* release the new BOS descriptor allocated by hub_port_init() */
+ if (udev->bos != bos) {
+ usb_release_bos_descriptor(udev);
+ udev->bos = bos;
+ }
return 0;
re_enumerate:
--
2.5.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] usb: hub: do not clear BOS field during reset device changbin.du@intel.com - 2016-01-18 14:20 +0100
csiph-web