mirror of
https://github.com/torvalds/linux.git
synced 2025-11-09 05:00:09 +02:00
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:
|
||
|---|---|---|
| .. | ||
| bits.h | ||
| ci.h | ||
| ci_hdrc_imx.c | ||
| ci_hdrc_imx.h | ||
| ci_hdrc_msm.c | ||
| ci_hdrc_pci.c | ||
| ci_hdrc_tegra.c | ||
| ci_hdrc_usb2.c | ||
| core.c | ||
| debug.c | ||
| host.c | ||
| host.h | ||
| Kconfig | ||
| Makefile | ||
| otg.c | ||
| otg.h | ||
| otg_fsm.c | ||
| otg_fsm.h | ||
| trace.c | ||
| trace.h | ||
| udc.c | ||
| udc.h | ||
| ulpi.c | ||
| usbmisc_imx.c | ||