diff options
author | Duoming Zhou <[email protected]> | 2022-05-24 12:48:41 +0800 |
---|---|---|
committer | Miquel Raynal <[email protected]> | 2022-06-09 15:03:23 +0200 |
commit | a61528d997619a518ee8c51cf0ef0513021afaff (patch) | |
tree | 26f185dba1f8a3fd06c60b74eff7ad6c939c3930 /lib/mpi/mpi-sub-ui.c | |
parent | 77087a04c8fd554134bddcb8a9ff87b21f357926 (diff) |
mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release
There is a deadlock between sm_release and sm_cache_flush_work
which is a work item. The cancel_work_sync in sm_release will
not return until sm_cache_flush_work is finished. If we hold
mutex_lock and use cancel_work_sync to wait the work item to
finish, the work item also requires mutex_lock. As a result,
the sm_release will be blocked forever. The race condition is
shown below:
(Thread 1) | (Thread 2)
sm_release |
mutex_lock(&ftl->mutex) | sm_cache_flush_work
| mutex_lock(&ftl->mutex)
cancel_work_sync | ...
This patch moves del_timer_sync and cancel_work_sync out of
mutex_lock in order to mitigate deadlock.
Fixes: 7d17c02a01a1 ("mtd: Add new SmartMedia/xD FTL")
Signed-off-by: Duoming Zhou <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions