]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: avoid to touch q->elevator without any protection
authorMing Lei <ming.lei@redhat.com>
Thu, 16 Jun 2022 01:44:00 +0000 (09:44 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 16 Jun 2022 20:45:15 +0000 (14:45 -0600)
commit28f5743344f5bc21824a4e1b58233c7cac00b73f
tree145de66b189943b28e6b089d4345459a7d22d2c6
parent08d94ef91824a486a1977c0bb07403eb7f21e3d4
blk-mq: avoid to touch q->elevator without any protection

q->elevator is referred in blk_mq_has_sqsched() without any protection,
no .q_usage_counter is held, no queue srcu and rcu read lock is held,
so potential use-after-free may be triggered.

Fix the issue by adding one queue flag for checking if the elevator
uses single queue style dispatch. Meantime the elevator feature flag
of ELEVATOR_F_MQ_AWARE isn't needed any more.

Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220616014401.817001-3-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c
block/blk-mq-sched.c
block/blk-mq.c
block/kyber-iosched.c
block/mq-deadline.c
include/linux/blkdev.h