blk-mq: prepare for implementing hctx table via xarray
authorMing Lei <ming.lei@redhat.com>
Tue, 8 Mar 2022 07:32:18 +0000 (15:32 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Mar 2022 00:57:19 +0000 (17:57 -0700)
commit4f481208749a22d3570073e629dbc27d7d27c8da
tree8df524f2cca05a364031383731151d6b9b8775cc
parentde0328d3a253a339be14a80fe2a0256ec26867da
blk-mq: prepare for implementing hctx table via xarray

It is inevitable to cause use-after-free on q->queue_hw_ctx between
queue_for_each_hw_ctx() and blk_mq_update_nr_hw_queues(). And converting
to xarray can fix the uaf, meantime code gets cleaner.

Prepare for converting q->queue_hctx_ctx into xarray, one thing is that
xa_for_each() can only accept 'unsigned long' as index, so changes type
of hctx index of queue_for_each_hw_ctx() into 'unsigned long'.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220308073219.91173-6-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-debugfs.c
block/blk-mq-sched.c
block/blk-mq-sysfs.c
block/blk-mq-tag.c
block/blk-mq.c
drivers/block/rnbd/rnbd-clt.c