android_kernel_motorola_sm6375/drivers/usb
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Duoming Zhou c025c4505f usb: chipidea: fix deadlock in ci_otg_del_timer
commit 7a58b8d6021426b796eebfae80983374d9a80a75 upstream.

There is a deadlock in ci_otg_del_timer(), the process is
shown below:

    (thread 1)                  |        (thread 2)
ci_otg_del_timer()              | ci_otg_hrtimer_func()
  ...                           |
  spin_lock_irqsave() //(1)     |  ...
  ...                           |
  hrtimer_cancel()              |  spin_lock_irqsave() //(2)
  (block forever)

We hold ci->lock in position (1) and use hrtimer_cancel() to
wait ci_otg_hrtimer_func() to stop, but ci_otg_hrtimer_func()
also need ci->lock in position (2). As a result, the
hrtimer_cancel() in ci_otg_del_timer() will be blocked forever.

This patch extracts hrtimer_cancel() from the protection of
spin_lock_irqsave() in order that the ci_otg_hrtimer_func()
could obtain the ci->lock.

What`s more, there will be no race happen. Because the
"next_timer" is always under the protection of
spin_lock_irqsave() and we only check whether "next_timer"
equals to NUM_OTG_FSM_TIMERS in the following code.

Fixes: 3a316ec4c9 ("usb: chipidea: use hrtimer for otg fsm timers")
Cc: stable <[email protected]>
Signed-off-by: Duoming Zhou <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-11-25 17:42:18 +01:00
..
atm
c67x00
cdns3 usb: cdns3: fix issue with rearming ISO OUT endpoint 2022-09-28 11:04:02 +02:00
chipidea usb: chipidea: fix deadlock in ci_otg_del_timer 2022-11-25 17:42:18 +01:00
class USB: cdc-acm: Add Icom PMR F3400 support (0c26:0020) 2022-09-15 12:04:52 +02:00
common usb: ulpi: Call of_node_put correctly 2022-02-16 12:52:52 +01:00
core usb: add NO_LPM quirk for Realforce 87U Keyboard 2022-11-25 17:42:18 +01:00
dwc2 usb: dwc2: fix wrong order of phy_power_on and phy_init 2022-09-15 12:04:52 +02:00
dwc3 Revert "usb: dwc3: disable USB core PHY management" 2022-11-25 17:42:17 +01:00
early
gadget usb: bdc: change state when port disconnected 2022-11-03 23:56:53 +09:00
host xhci: Remove device endpoints from bandwidth list when freeing the device 2022-11-03 23:56:53 +09:00
image
isp1760
misc usb: idmouse: fix an uninit-value in idmouse_open 2022-10-26 13:22:58 +02:00
mon usb: mon: make mmapped memory read only 2022-10-15 07:54:38 +02:00
mtu3 usb: mtu3: fix USB 3.0 dual-role-switch from device to host 2022-05-09 09:03:20 +02:00
musb usb: musb: Fix musb_gadget.c rxstate overflow bug 2022-10-26 13:22:58 +02:00
phy usb: phy: tahvo: add IRQ check 2021-09-15 09:47:35 +02:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-08-25 11:18:33 +02:00
roles
serial USB: serial: option: add Fibocom FM160 0x0111 composition 2022-11-25 17:42:18 +01:00
storage Revert "usb: storage: Add quirk for Samsung Fit flash" 2022-10-26 13:22:58 +02:00
typec usb: typec: altmodes/displayport: correct pin assignment for UFP receptacles 2022-09-15 12:04:52 +02:00
usbip usb: usbip: add missing device lock on tweak configuration cmd 2022-06-14 18:11:51 +02:00
Kconfig
Makefile
usb-skeleton.c