diff options
author | Ming Lei <ming.lei@redhat.com> | 2022-06-16 03:44:00 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-16 22:45:15 +0200 |
commit | 4d337cebcb1c27d9b48c48b9a98e939d4552d584 (patch) | |
tree | 145de66b189943b28e6b089d4345459a7d22d2c6 /block/kyber-iosched.c | |
parent | blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none (diff) | |
download | linux-4d337cebcb1c27d9b48c48b9a98e939d4552d584.tar.xz linux-4d337cebcb1c27d9b48c48b9a98e939d4552d584.zip |
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>
Diffstat (limited to 'block/kyber-iosched.c')
-rw-r--r-- | block/kyber-iosched.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index 70ff2a599ef6..8f7c745b4a57 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c @@ -421,6 +421,8 @@ static int kyber_init_sched(struct request_queue *q, struct elevator_type *e) blk_stat_enable_accounting(q); + blk_queue_flag_clear(QUEUE_FLAG_SQ_SCHED, q); + eq->elevator_data = kqd; q->elevator = eq; @@ -1033,7 +1035,6 @@ static struct elevator_type kyber_sched = { #endif .elevator_attrs = kyber_sched_attrs, .elevator_name = "kyber", - .elevator_features = ELEVATOR_F_MQ_AWARE, .elevator_owner = THIS_MODULE, }; |