linux/drivers/usb
Zhangjiantao (Kirin, nanjing) b31d9d6d7a xhci: solve a double free problem while doing s4
when system is doing s4, the process of xhci_resume may be as below:
1、xhci_mem_cleanup
2、xhci_init->xhci_mem_init->xhci_mem_cleanup(when memory is not enough).
xhci_mem_cleanup will be executed twice when system is out of memory.
xhci->port_caps is freed in xhci_mem_cleanup,but it isn't set to NULL.
It will be freed twice when xhci_mem_cleanup is called the second time.

We got following bug when system resumes from s4:

kernel BUG at mm/slub.c:309!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
CPU: 0 PID: 5929 Tainted: G S   W   5.4.96-arm64-desktop #1
pc : __slab_free+0x5c/0x424
lr : kfree+0x30c/0x32c

Call trace:
 __slab_free+0x5c/0x424
 kfree+0x30c/0x32c
 xhci_mem_cleanup+0x394/0x3cc
 xhci_mem_init+0x9ac/0x1070
 xhci_init+0x8c/0x1d0
 xhci_resume+0x1cc/0x5fc
 xhci_plat_resume+0x64/0x70
 platform_pm_thaw+0x28/0x60
 dpm_run_callback+0x54/0x24c
 device_resume+0xd0/0x200
 async_resume+0x24/0x60
 async_run_entry_fn+0x44/0x110
 process_one_work+0x1f0/0x490
 worker_thread+0x5c/0x450
 kthread+0x158/0x160
 ret_from_fork+0x10/0x24

Original patch that caused this issue was backported to 4.4 stable,
so this should be backported to 4.4 stabe as well.

Fixes: cf0ee7c60c ("xhci: Fix memory leak when caching protocol extended capability PSI tables - take 2")
Cc: stable@vger.kernel.org # v4.4+
Signed-off-by: Jiantao Zhang <water.zhangjiantao@huawei.com>
Signed-off-by: Tao Xue <xuetao09@huawei.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210617150354.1512157-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-17 17:34:29 +02:00
..
atm usb: atm: cxacru: Fix typo in comment 2021-05-21 20:05:40 +02:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 Linux 5.13-rc6 2021-06-14 09:18:07 +02:00
chipidea Merge 5.13-rc4 into usb-next 2021-05-31 09:50:26 +02:00
class cdc-wdm: untangle a circular dependency between callback and softint 2021-05-10 14:39:51 +02:00
common usb: common: ulpi: Add leading underscores for function name '__ulpi_register_driver()' 2021-05-27 09:45:27 +02:00
core USB: core: Avoid WARNings for 0-length descriptor requests 2021-06-09 11:11:39 +02:00
dwc2 usb: dwc2: Don't reset the core after setting turnaround time 2021-06-09 11:25:07 +02:00
dwc3 Linux 5.13-rc6 2021-06-14 09:18:07 +02:00
early usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() 2020-09-25 16:29:09 +02:00
gadget USB: UDC: net2280: remove redundant continue statement 2021-06-17 15:31:53 +02:00
host xhci: solve a double free problem while doing s4 2021-06-17 17:34:29 +02:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760: Fix meaningless check in isp1763_run() 2021-06-15 15:40:58 +02:00
misc USB: misc: Add onboard_usb_hub driver 2021-06-15 15:48:35 +02:00
mon
mtu3 usb: mtu3: use clock bulk to get clocks 2021-06-15 15:46:45 +02:00
musb usb: musb: Implement tracing for state change events 2021-06-14 10:25:16 +02:00
phy usb: phy: tegra: Correct definition of B_SESS_VLD_WAKEUP_EN bit 2021-06-15 15:36:23 +02:00
renesas_usbhs usb: renesas_usbhs: fix error return code of usbhsf_pkt_handler() 2021-03-23 12:42:15 +01:00
roles usb: roles: add helper usb_role_string() 2021-05-27 09:17:18 +02:00
serial USB: serial: cp210x: fix CP2102N-A01 modem control 2021-06-10 16:59:00 +02:00
storage usb: storage: datafab: remove redundant assignment of variable result 2021-04-22 10:52:10 +02:00
typec usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() 2021-06-17 15:39:33 +02:00
usbip Scheduler updates for this cycle are: 2021-04-28 13:33:57 -07:00
Kconfig
Makefile usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
usb-skeleton.c