Skip to content

Commit 4d0e1f2

Browse files
poluoaxboe
authored andcommitted
blk-mq: use queue_hctx in blk_mq_map_queue_type
Some caller of blk_mq_map_queue_type now didn't grab 'q_usage_counter', such as blk_mq_cpu_mapped_to_hctx, so we need protect 'queue_hw_ctx' through rcu. Also checked all other functions, no more missed cases. Fixes: 89e1fb7 ("blk-mq: fix potential uaf for 'queue_hw_ctx'") Reported-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c1536df commit 4d0e1f2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

block/blk-mq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue_type(struct request_queue *
8484
enum hctx_type type,
8585
unsigned int cpu)
8686
{
87-
return q->queue_hw_ctx[q->tag_set->map[type].mq_map[cpu]];
87+
return queue_hctx((q), (q->tag_set->map[type].mq_map[cpu]));
8888
}
8989

9090
static inline enum hctx_type blk_mq_get_hctx_type(blk_opf_t opf)

0 commit comments

Comments
 (0)