aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-sub-ui.c
diff options
context:
space:
mode:
authorDuoming Zhou <[email protected]>2022-09-18 11:33:12 +0800
committerGreg Kroah-Hartman <[email protected]>2022-11-09 12:34:18 +0100
commit7a58b8d6021426b796eebfae80983374d9a80a75 (patch)
treec18cac8e1ae5fd5e1f234b5a4ac9b3ba58ae0e83 /lib/mpi/mpi-sub-ui.c
parentd68cc25b7c7fb3034c5a5b5f350a0b858c6d5a45 (diff)
usb: chipidea: fix deadlock in ci_otg_del_timer
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: 3a316ec4c91c ("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]>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions