+12
−19
+55
−20
+3
−1
Loading
hulk inclusion
category: bugfix
Bugzilla: 47615
CVE: N/A
-----------------------------------------------
add the new functions mtd_table_mutex_lock/unlock to instead the
mutex_lock(&mtd_table_mutex)/mutex_unlock(&mtd_table_mutex),this
modification can avoid the deadlock when insmod ftl.ko
the deadlock is caused by the commit 857814ee65db ("mtd: fix: avoid
race condition when accessing mtd->usecount")
the process is as follows:
init_ftl
register_mtd_blktrans
mutex_lock(&mtd_table_mutex) //mtd_table_mutex locked
ftl_add_mtd
add_mtd_blktrans_dev
device_add_disk
register_disk
blkdev_get
__blkdev_get
blktrans_open
mutex_lock(&mtd_table_mutex) //dead lock
so we add the mtd_table_mutex_owner to record current process.
if the lock is locked before , it can jump the lock where will deadlock.
it solved the above issue,also can prevent some mtd_table_mutex
deadlock undiscovered.
Signed-off-by:
Gu Zheng <guzheng1@huawei.com>
Acked-by:
Miao Xie <miaoxie@huawei.com>
Signed-off-by:
Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by:
zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by:
Hou Tao <houta1@huawei.com>
conflict:
drivers/mtd/mtdcore.c
drivers/mtd/mtdcore.h
Signed-off-by:
Ye Bin <yebin10@huawei.com>
Reviewed-by:
Hou Tao <houtao1@huawei.com>
Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>