From 41eef20b8d0e72aba9c77aecc1af981122c2d4c3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 2 Oct 2014 16:32:28 -0700 Subject: [PATCH] 3.10-stable patches added patches: storage-add-single-lun-quirk-for-jaz-usb-adapter.patch usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch usb-zte_ev-fix-removed-pids.patch xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch --- queue-3.10/series | 9 +++ ...single-lun-quirk-for-jaz-usb-adapter.patch | 41 ++++++++++ ...ven-after-the-controller-has-stopped.patch | 43 ++++++++++ ...rence-when-processing-from-eventlist.patch | 47 +++++++++++ ...-usbconnect-2000-usb-to-scsi-adapter.patch | 40 ++++++++++ ...ologies-iconnect-usb-to-scsi-adapter.patch | 44 +++++++++++ ...ntrega-xircom-usb-to-scsi-converters.patch | 79 +++++++++++++++++++ queue-3.10/usb-zte_ev-fix-removed-pids.patch | 43 ++++++++++ ...ference-if-xhci-initialization-fails.patch | 32 ++++++++ ...ibernate-with-hw-lpm-capable-devices.patch | 55 +++++++++++++ 10 files changed, 433 insertions(+) create mode 100644 queue-3.10/storage-add-single-lun-quirk-for-jaz-usb-adapter.patch create mode 100644 queue-3.10/usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch create mode 100644 queue-3.10/usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch create mode 100644 queue-3.10/usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch create mode 100644 queue-3.10/usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch create mode 100644 queue-3.10/usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch create mode 100644 queue-3.10/usb-zte_ev-fix-removed-pids.patch create mode 100644 queue-3.10/xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch create mode 100644 queue-3.10/xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch diff --git a/queue-3.10/series b/queue-3.10/series index 69000201b55..08aca23abcc 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -48,3 +48,12 @@ usb-zte_ev-remove-duplicate-qualcom-pid.patch usb-sierra-avoid-cdc-class-functions-on-68a3-devices.patch usb-sierra-add-1199-68aa-device-id.patch usb-ftdi_sio-add-support-for-novitus-bono-e-thermal-printer.patch +usb-zte_ev-fix-removed-pids.patch +xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch +xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch +usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch +storage-add-single-lun-quirk-for-jaz-usb-adapter.patch +usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch +usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch +usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch +usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch diff --git a/queue-3.10/storage-add-single-lun-quirk-for-jaz-usb-adapter.patch b/queue-3.10/storage-add-single-lun-quirk-for-jaz-usb-adapter.patch new file mode 100644 index 00000000000..aa602f79710 --- /dev/null +++ b/queue-3.10/storage-add-single-lun-quirk-for-jaz-usb-adapter.patch @@ -0,0 +1,41 @@ +From c66f1c62e85927357e7b3f4c701614dcb5c498a2 Mon Sep 17 00:00:00 2001 +From: Mark +Date: Thu, 11 Sep 2014 13:15:45 +0100 +Subject: storage: Add single-LUN quirk for Jaz USB Adapter + +From: Mark + +commit c66f1c62e85927357e7b3f4c701614dcb5c498a2 upstream. + +The Iomega Jaz USB Adapter is a SCSI-USB converter cable. The hardware +seems to be identical to e.g. the Microtech XpressSCSI, using a Shuttle/ +SCM chip set. However its firmware restricts it to only work with Jaz +drives. + +On connecting the cable a message like this appears four times in the log: + reset full speed USB device number 4 using uhci_hcd + +That's non-fatal but the US_FL_SINGLE_LUN quirk fixes it. + +Signed-off-by: Mark Knibbs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/unusual_devs.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -741,6 +741,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_SINGLE_LUN ), + ++UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100, ++ "Iomega", ++ "Jaz USB Adapter", ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, ++ US_FL_SINGLE_LUN ), ++ + /* Reported by */ + UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, + "LaCie", diff --git a/queue-3.10/usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch b/queue-3.10/usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch new file mode 100644 index 00000000000..3b164da21ac --- /dev/null +++ b/queue-3.10/usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch @@ -0,0 +1,43 @@ +From 7312b5ddd47fee2356baa78c5516ef8e04eed452 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Wed, 17 Sep 2014 11:23:54 -0400 +Subject: USB: EHCI: unlink QHs even after the controller has stopped + +From: Alan Stern + +commit 7312b5ddd47fee2356baa78c5516ef8e04eed452 upstream. + +Old code in ehci-hcd tries to expedite disabling endpoints after the +controller has stopped, by destroying the endpoint's associated QH +without first unlinking the QH. This was necessary back when the +driver wasn't so careful about keeping track of the controller's +state. + +But now we are careful about it, and the driver knows that when the +controller isn't running, no unlinking delay is needed. Furthermore, +skipping the unlink step will trigger a BUG() in qh_destroy() when the +preceding QH is released, because the link pointer will be non-NULL. + +Removing the lines that skip the unlinking step and go directly to +QH_STATE_IDLE fixes the problem. + +Signed-off-by: Alan Stern +Reported-by: Joe Lawrence +Tested-by: Joe Lawrence +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/ehci-hcd.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -972,8 +972,6 @@ rescan: + } + + qh->exception = 1; +- if (ehci->rh_state < EHCI_RH_RUNNING) +- qh->qh_state = QH_STATE_IDLE; + switch (qh->qh_state) { + case QH_STATE_LINKED: + case QH_STATE_COMPLETING: diff --git a/queue-3.10/usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch b/queue-3.10/usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch new file mode 100644 index 00000000000..5c0e6791e4a --- /dev/null +++ b/queue-3.10/usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch @@ -0,0 +1,47 @@ +From c605f3cdff53a743f6d875b76956b239deca1272 Mon Sep 17 00:00:00 2001 +From: Joe Lawrence +Date: Wed, 10 Sep 2014 15:07:50 -0400 +Subject: usb: hub: take hub->hdev reference when processing from eventlist + +From: Joe Lawrence + +commit c605f3cdff53a743f6d875b76956b239deca1272 upstream. + +During surprise device hotplug removal tests, it was observed that +hub_events may try to call usb_lock_device on a device that has already +been freed. Protect the usb_device by taking out a reference (under the +hub_event_lock) when hub_events pulls it off the list, returning the +reference after hub_events is finished using it. + +Signed-off-by: Joe Lawrence +Suggested-by: David Bulkow for using kref +Suggested-by: Alan Stern for placement +Acked-by: Alan Stern +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/hub.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -4702,9 +4702,10 @@ static void hub_events(void) + + hub = list_entry(tmp, struct usb_hub, event_list); + kref_get(&hub->kref); ++ hdev = hub->hdev; ++ usb_get_dev(hdev); + spin_unlock_irq(&hub_event_lock); + +- hdev = hub->hdev; + hub_dev = hub->intfdev; + intf = to_usb_interface(hub_dev); + dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", +@@ -4919,6 +4920,7 @@ static void hub_events(void) + usb_autopm_put_interface(intf); + loop_disconnected: + usb_unlock_device(hdev); ++ usb_put_dev(hdev); + kref_put(&hub->kref, hub_release); + + } /* end while (1) */ diff --git a/queue-3.10/usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch b/queue-3.10/usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch new file mode 100644 index 00000000000..0d7385881e5 --- /dev/null +++ b/queue-3.10/usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch @@ -0,0 +1,40 @@ +From 67d365a57a51fb9dece6a5ceb504aa381cae1e5b Mon Sep 17 00:00:00 2001 +From: Mark +Date: Tue, 16 Sep 2014 16:22:50 +0100 +Subject: USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter + +From: Mark + +commit 67d365a57a51fb9dece6a5ceb504aa381cae1e5b upstream. + +The Adaptec USBConnect 2000 is another SCSI-USB converter which uses +Shuttle Technology/SCM Microsystems chips. The US_FL_SCM_MULT_TARG quirk is +required to use SCSI devices with ID other than 0. + +I don't have a USBConnect 2000, but based on the other entries for Shuttle/ +SCM-based converters this patch is very likely correct. I used 0x0000 and +0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which +bcdDevice value the product uses. + +Signed-off-by: Mark Knibbs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/unusual_devs.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x + "PhotoSmart R707", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), + ++UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999, ++ "Adaptec", ++ "USBConnect 2000", ++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, ++ US_FL_SCM_MULT_TARG ), ++ + /* Reported by Sebastian Kapfer + * and Olaf Hering (different bcd's, same vendor/product) + * for USB floppies that need the SINGLE_LUN enforcement. diff --git a/queue-3.10/usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch b/queue-3.10/usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch new file mode 100644 index 00000000000..404613ab4ae --- /dev/null +++ b/queue-3.10/usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch @@ -0,0 +1,44 @@ +From b6a3ed677991558ce09046397a7c4d70530d15b3 Mon Sep 17 00:00:00 2001 +From: Mark +Date: Tue, 16 Sep 2014 16:51:41 +0100 +Subject: USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter + +From: Mark + +commit b6a3ed677991558ce09046397a7c4d70530d15b3 upstream. + +Hi, + +The Ariston Technologies iConnect 025 and iConnect 050 (also known as e.g. +iSCSI-50) are SCSI-USB converters which use Shuttle Technology/SCM +Microsystems chips. Only the connectors differ; both have the same USB ID. +The US_FL_SCM_MULT_TARG quirk is required to use SCSI devices with ID other +than 0. + +I don't have one of these, but based on the other entries for Shuttle/ +SCM-based converters this patch is very likely correct. I used 0x0000 and +0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which +bcdDevice value the products use. + +Signed-off-by: Mark Knibbs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/unusual_devs.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1979,6 +1979,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), + ++UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999, ++ "Ariston Technologies", ++ "iConnect USB to SCSI adapter", ++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, ++ US_FL_SCM_MULT_TARG ), ++ + /* Reported by Hans de Goede + * These Appotech controllers are found in Picture Frames, they provide a + * (buggy) emulation of a cdrom drive which contains the windows software diff --git a/queue-3.10/usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch b/queue-3.10/usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch new file mode 100644 index 00000000000..f519e1a6634 --- /dev/null +++ b/queue-3.10/usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch @@ -0,0 +1,79 @@ +From c80b4495c61636edc58fe1ce300f09f24db28e10 Mon Sep 17 00:00:00 2001 +From: Mark +Date: Wed, 17 Sep 2014 19:15:43 +0100 +Subject: USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters + +From: Mark + +commit c80b4495c61636edc58fe1ce300f09f24db28e10 upstream. + +This patch adds quirks for Entrega Technologies (later Xircom PortGear) USB- +SCSI converters. They use Shuttle Technology EUSB-01/EUSB-S1 chips. The +US_FL_SCM_MULT_TARG quirk is needed to allow multiple devices on the SCSI +chain to be accessed. Without it only the (single) device with SCSI ID 0 +can be used. + +The standalone converter sold by Entrega had model number U1-SC25. Xircom +acquired Entrega and re-branded the product line PortGear. The PortGear USB +to SCSI Converter (model PGSCSI) is internally identical to the Entrega +product, but later models may use a different USB ID. The Entrega-branded +units have USB ID 1645:0007, as does my Xircom PGSCSI, but the Windows and +Macintosh drivers also support 085A:0028. + +Entrega also sold the "Mac USB Dock", which provides two USB ports, a Mac +(8-pin mini-DIN) serial port and a SCSI port. It appears to the computer as +a four-port hub, USB-serial, and USB-SCSI converters. The USB-SCSI part may +have initially used the same ID as the standalone U1-SC25 (1645:0007), but +later production used 085A:0026. + +My Xircom PortGear PGSCSI has bcdDevice=0x0100. Units with bcdDevice=0x0133 +probably also exist. + +This patch adds quirks for 1645:0007, 085A:0026 and 085A:0028. The Windows +driver INF file also mentions 085A:0032 "PortStation SCSI Module", but I +couldn't find any mention of that actually existing in the wild; perhaps it +was cancelled before release? + +Signed-off-by: Mark Knibbs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/storage/unusual_devs.h | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1125,6 +1125,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_NOT_LOCKABLE), + ++UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133, ++ "Xircom", ++ "PortGear USB-SCSI (Mac USB Dock)", ++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, ++ US_FL_SCM_MULT_TARG ), ++ ++UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133, ++ "Xircom", ++ "PortGear USB to SCSI Converter", ++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, ++ US_FL_SCM_MULT_TARG ), ++ + /* Submitted by Jan De Luyck */ + UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, + "CITIZEN", +@@ -1957,6 +1969,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), + ++/* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) ++ * and Mac USB Dock USB-SCSI */ ++UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133, ++ "Entrega Technologies", ++ "USB to SCSI Converter", ++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, ++ US_FL_SCM_MULT_TARG ), ++ + /* Reported by Robert Schedel + * Note: this is a 'super top' device like the above 14cd/6600 device */ + UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, diff --git a/queue-3.10/usb-zte_ev-fix-removed-pids.patch b/queue-3.10/usb-zte_ev-fix-removed-pids.patch new file mode 100644 index 00000000000..e6a5df8e6ef --- /dev/null +++ b/queue-3.10/usb-zte_ev-fix-removed-pids.patch @@ -0,0 +1,43 @@ +From 3096691011d01cef56b243a5e65431405c07d574 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Thu, 28 Aug 2014 12:46:54 +0200 +Subject: USB: zte_ev: fix removed PIDs + +From: Johan Hovold + +commit 3096691011d01cef56b243a5e65431405c07d574 upstream. + +Add back some PIDs that were mistakingly remove when reverting commit +73228a0538a7 ("USB: option,zte_ev: move most ZTE CDMA devices to +zte_ev"), which apparently did more than its commit message claimed in +that it not only moved some PIDs from option to zte_ev but also added +some new ones. + +Fixes: 63a901c06e3c ("Revert "USB: option,zte_ev: move most ZTE CDMA +devices to zte_ev"") + +Reported-by: Lei Liu +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/zte_ev.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/usb/serial/zte_ev.c ++++ b/drivers/usb/serial/zte_ev.c +@@ -273,6 +273,14 @@ static void zte_ev_usb_serial_close(stru + } + + static const struct usb_device_id id_table[] = { ++ { USB_DEVICE(0x19d2, 0xffec) }, ++ { USB_DEVICE(0x19d2, 0xffee) }, ++ { USB_DEVICE(0x19d2, 0xfff6) }, ++ { USB_DEVICE(0x19d2, 0xfff7) }, ++ { USB_DEVICE(0x19d2, 0xfff8) }, ++ { USB_DEVICE(0x19d2, 0xfff9) }, ++ { USB_DEVICE(0x19d2, 0xfffb) }, ++ { USB_DEVICE(0x19d2, 0xfffc) }, + /* MG880 */ + { USB_DEVICE(0x19d2, 0xfffd) }, + { }, diff --git a/queue-3.10/xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch b/queue-3.10/xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch new file mode 100644 index 00000000000..02df46a64c9 --- /dev/null +++ b/queue-3.10/xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch @@ -0,0 +1,32 @@ +From c207e7c50f31113c24a9f536fcab1e8a256985d7 Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Thu, 11 Sep 2014 13:55:48 +0300 +Subject: xhci: Fix null pointer dereference if xhci initialization fails + +From: Mathias Nyman + +commit c207e7c50f31113c24a9f536fcab1e8a256985d7 upstream. + +If xhci initialization fails before the roothub bandwidth +domains (xhci->rh_bw[i]) are allocated it will oops when +trying to access rh_bw members in xhci_mem_cleanup(). + +Reported-by: Manuel Reimer +Signed-off-by: Mathias Nyman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci-mem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/host/xhci-mem.c ++++ b/drivers/usb/host/xhci-mem.c +@@ -1795,7 +1795,7 @@ void xhci_mem_cleanup(struct xhci_hcd *x + } + + num_ports = HCS_MAX_PORTS(xhci->hcs_params1); +- for (i = 0; i < num_ports; i++) { ++ for (i = 0; i < num_ports && xhci->rh_bw; i++) { + struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; + for (j = 0; j < XHCI_MAX_INTERVAL; j++) { + struct list_head *ep = &bwt->interval_bw[j].endpoints; diff --git a/queue-3.10/xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch b/queue-3.10/xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch new file mode 100644 index 00000000000..501a329df78 --- /dev/null +++ b/queue-3.10/xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch @@ -0,0 +1,55 @@ +From 96044694b8511bc2b04df0776b4ba295cfe005c0 Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Thu, 11 Sep 2014 13:55:50 +0300 +Subject: xhci: fix oops when xhci resumes from hibernate with hw lpm capable devices + +From: Mathias Nyman + +commit 96044694b8511bc2b04df0776b4ba295cfe005c0 upstream. + +Resuming from hibernate (S4) will restart and re-initialize xHC. +The device contexts are freed and will be re-allocated later during device reset. + +Usb core will disable link pm in device resume before device reset, which will +try to change the max exit latency, accessing the device contexts before they are re-allocated. + +There is no need to zero (disable) the max exit latency when disabling hw lpm +for a freshly re-initialized xHC. So check that device context exists before +doing anything. The max exit latency will be set again after device reset when usb core +enables the link pm. + +Reported-by: Imre Deak +Tested-by: Imre Deak +Signed-off-by: Mathias Nyman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -4407,13 +4407,21 @@ static int xhci_change_max_exit_latency( + int ret; + + spin_lock_irqsave(&xhci->lock, flags); +- if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) { ++ ++ virt_dev = xhci->devs[udev->slot_id]; ++ ++ /* ++ * virt_dev might not exists yet if xHC resumed from hibernate (S4) and ++ * xHC was re-initialized. Exit latency will be set later after ++ * hub_port_finish_reset() is done and xhci->devs[] are re-allocated ++ */ ++ ++ if (!virt_dev || max_exit_latency == virt_dev->current_mel) { + spin_unlock_irqrestore(&xhci->lock, flags); + return 0; + } + + /* Attempt to issue an Evaluate Context command to change the MEL. */ +- virt_dev = xhci->devs[udev->slot_id]; + command = xhci->lpm_command; + xhci_slot_copy(xhci, command->in_ctx, virt_dev->out_ctx); + spin_unlock_irqrestore(&xhci->lock, flags); -- 2.47.3