WSL2-Linux-Kernel/drivers/usb
Chunfeng Yun ee53a7a880 usb: mtu3: fix kernel panic at qmu transfer done irq handler
[ Upstream commit d28f4091ea ]

When handle qmu transfer irq, it will unlock @mtu->lock before give back
request, if another thread handle disconnect event at the same time, and
try to disable ep, it may lock @mtu->lock and free qmu ring, then qmu
irq hanlder may get a NULL gpd, avoid the KE by checking gpd's value before
handling it.

e.g.
qmu done irq on cpu0                 thread running on cpu1

qmu_done_tx()
  handle gpd [0]
    mtu3_requ_complete()        mtu3_gadget_ep_disable()
      unlock @mtu->lock
        give back request         lock @mtu->lock
                                    mtu3_ep_disable()
                                      mtu3_gpd_ring_free()
                                   unlock @mtu->lock
      lock @mtu->lock
    get next gpd [1]

[1]: goto [0] to handle next gpd, and next gpd may be NULL.

Fixes: 48e0d3735a ("usb: mtu3: supports new QMU format")
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20230417025203.18097-3-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:00:33 +09:00
..
atm
c67x00
cdns3 usb: cdnsp: Fixes error: uninitialized symbol 'len' 2023-04-13 16:48:20 +02:00
chipidea usb: chipidea: fix missing goto in `ci_hdrc_probe` 2023-05-11 23:00:33 +09:00
class USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) 2022-09-08 12:28:06 +02:00
common Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout" 2023-01-18 11:48:58 +01:00
core USB: fix memory leak with using debugfs_lookup() 2023-03-11 13:57:34 +01:00
dwc2 usb: dwc2: fix a devres leak in hw_enable upon suspend resume 2023-03-30 12:47:55 +02:00
dwc3 usb: dwc3: gadget: Change condition for processing suspend event 2023-05-11 23:00:31 +09:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:39:39 +01:00
gadget usb: gadget: tegra-xudc: Fix crash in vbus_draw 2023-05-11 23:00:33 +09:00
host usb: host: xhci-rcar: remove leftover quirk handling 2023-05-11 23:00:31 +09:00
image
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-06-09 10:22:27 +02:00
misc USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100 2023-01-24 07:22:45 +01:00
mon usb: mon: make mmapped memory read only 2022-10-12 09:53:28 +02:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:00:33 +09:00
musb usb: musb: mediatek: don't unregister something that wasn't registered 2023-03-10 09:39:40 +01:00
phy extcon: Fix extcon_get_extcon_dev() error handling 2022-06-14 18:36:21 +02:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-08-25 11:40:33 +02:00
roles usb: roles: fix of node refcount leak in usb_role_switch_is_parent() 2022-12-31 13:14:30 +01:00
serial USB: serial: option: add UNISOC vendor and TOZED LT70C product 2023-05-01 08:23:23 +09:00
storage uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS583Gen 2 2023-03-30 12:47:51 +02:00
typec usb: typec: altmodes/displayport: Fix configure initial pin assignment 2023-04-13 16:48:21 +02:00
usbip usb: usbip: add missing device lock on tweak configuration cmd 2022-06-14 18:36:04 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c