aboutsummaryrefslogtreecommitdiff
path: root/lib/test_overflow.c
diff options
context:
space:
mode:
authorDesmond Cheong Zhi Xi <[email protected]>2021-07-17 18:07:19 +0800
committerMiquel Raynal <[email protected]>2021-08-06 21:44:16 +0200
commitb7abb051682263e51866bc78762fd0083d64c5ed (patch)
tree713b1e0360420fb748de7623f88cb9e8eea10162 /lib/test_overflow.c
parent99dc4ad992bf156692b088fab4d98deab7cbd3e6 (diff)
mtd: fix lock hierarchy in deregister_mtd_blktrans
There is a lock hierarchy of major_names_lock --> mtd_table_mutex. One existing chain is as follows: 1. major_names_lock --> loop_ctl_mutex (when blk_request_module calls loop_probe) 2. loop_ctl_mutex --> bdev->bd_mutex (when loop_control_ioctl calls loop_remove, which then calls del_gendisk) 3. bdev->bd_mutex --> mtd_table_mutex (when blkdev_get_by_dev calls __blkdev_get, which then calls blktrans_open) Since unregister_blkdev grabs the major_names_lock, we need to call it outside the critical section for mtd_table_mutex, otherwise we invert the lock hierarchy. Reported-by: Hillf Danton <[email protected]> Signed-off-by: Desmond Cheong Zhi Xi <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions