linux_dsm_epyc7002/drivers/usb
Marek Szyprowski 37d9453b05 usb: gadget: udc: Flush pending work also in error path
When binding an UDC driver to the pending gadget fails in
check_pending_gadget_drivers(), the usb_add_gadget_udc_release() function
ends without waiting for the usb_gadget_state_work to finish, what in
turn might cause the whole struct usb_gadget being freed by the caller
before the usb_gadget_state_work being executed.

This can be observed on some boards with USB Mass Storage gadget
compiled-in and kernel booted without the needed module parameters:

dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter besl=1
dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter g_np_tx_fifo_size=1024
dwc2 12480000.hsotg: EPs: 16, dedicated fifos, 7808 entries in SPRAM
Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
no file given for LUN0
g_mass_storage 12480000.hsotg: failed to start g_mass_storage: -22
dwc2: probe of 12480000.hsotg failed with error -22
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = (ptrval)
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 88 Comm: kworker/1:2 Not tainted 5.8.0-rc5-next-20200715-00062-gc5bb489ae825-dirty #8792
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue:  0x0 (rcu_gp)
PC is at process_one_work+0x44/0x7dc
...
Process kworker/1:2 (pid: 88, stack limit = 0x(ptrval))
Stack: (0xed9f1f00 to 0xed9f2000)
...
[<c0148590>] (process_one_work) from [<c0148d6c>] (worker_thread+0x44/0x51c)
[<c0148d6c>] (worker_thread) from [<c01500c0>] (kthread+0x158/0x1a0)
[<c01500c0>] (kthread) from [<c0100114>] (ret_from_fork+0x14/0x20)
Exception stack(0xed9f1fb0 to 0xed9f1ff8)
...
---[ end trace 5033c1326a62e5f3 ]---
note: kworker/1:2[88] exited with preempt_count 1

Fix this by flushing pending work in error path.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-07-24 16:45:12 +03:00
..
atm usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
c67x00 Linux 5.8-rc6 2020-07-20 09:41:30 +02:00
cdns3 usb: cdns3: gadget: improve the set_configuration handling 2020-07-24 16:45:11 +03:00
chipidea Linux 5.8-rc6 2020-07-20 09:41:30 +02:00
class usb: class: cdc-wdm: Provide description for usb_cdc_wdm_register()'s manage_power arg 2020-07-15 17:25:57 +02:00
common USB: Replace HTTP links with HTTPS ones 2020-07-21 13:41:57 +02:00
core usb: usbfs: stop using compat_alloc_user_space 2020-07-22 13:13:22 +02:00
dwc2 usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs 2020-07-23 14:45:36 +03:00
dwc3 usb: dwc3: meson-g12a: fix shared reset control use 2020-07-24 16:45:11 +03:00
early usb: early: xhci-dbc: File headers are not good candidates for kerneldoc 2020-07-09 17:19:59 +02:00
gadget usb: gadget: udc: Flush pending work also in error path 2020-07-24 16:45:12 +03:00
host usb: ohci-omap: Convert to use GPIO descriptors 2020-07-21 13:42:37 +02:00
image usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
isp1760 usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
misc usb: appledisplay: remove needless check before usb_free_coherent() 2020-07-21 13:41:58 +02:00
mon USB: mon: Use scnprintf() for avoiding potential buffer overflow 2020-03-12 09:49:28 +01:00
mtu3 usb: mtu3: mtu3_trace: Supply missing mtu3_debug.h include file 2020-07-15 17:25:57 +02:00
musb USB: musb: Remove unused inline function 2020-07-15 16:48:10 +02:00
phy usb: phy: Replace HTTP links with HTTPS ones 2020-07-15 16:33:51 +02:00
renesas_usbhs usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
roles usb: roles: Switch on role-switch uevent reporting 2020-05-13 14:20:49 +02:00
serial Linux 5.8-rc6 2020-07-20 09:41:30 +02:00
storage USB: storage: replace HTTP links with HTTPS ones 2020-07-09 18:06:12 +02:00
typec usb: typec: tcpm: Stay in BIST mode till hardreset or unattached 2020-07-21 13:38:21 +02:00
usbip usbip: Use fallthrough pseudo-keyword 2020-07-09 18:06:35 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
usb-skeleton.c USB: usb-skeleton: drop redundant in-urb check 2019-10-10 12:41:19 +02:00