block: Protect less code with sysfs_lock in blk_{un,}register_queue()
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 17 Jan 2018 19:48:10 +0000 (11:48 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 18 Jan 2018 19:54:44 +0000 (12:54 -0700)
commit2c2086afc2b8b974fac32cb028e73dc27bfae442
tree0a9d392612cbbdb0d3dcdf9190444d1964eeb962
parent14a23498ba97683c6790b1bcd8b2cdfe9ad99797
block: Protect less code with sysfs_lock in blk_{un,}register_queue()

The __blk_mq_register_dev(), blk_mq_unregister_dev(),
elv_register_queue() and elv_unregister_queue() calls need to be
protected with sysfs_lock but other code in these functions not.
Hence protect only this code with sysfs_lock. This patch fixes a
locking inversion issue in blk_unregister_queue() and also in an
error path of blk_register_queue(): it is not allowed to hold
sysfs_lock around the kobject_del(&q->kobj) call.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-sysfs.c