]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none
authorMing Lei <ming.lei@redhat.com>
Thu, 16 Jun 2022 01:43:59 +0000 (09:43 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 16 Jun 2022 20:45:15 +0000 (14:45 -0600)
commit174dc6c6d675ccd3486e83ea326fd23b3b662c3d
tree9a9e375e7ad18f3d650f37756f701b486b3a436b
parentc6bf2bf90349638074de95d836cdf427d4cb2a0b
blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none

elevator can be tore down by sysfs switch interface or disk release, so
hold ->sysfs_lock before referring to q->elevator, then potential
use-after-free can be avoided.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220616014401.817001-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c