blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue
authorYang Yang <yang.yang@vivo.com>
Fri, 9 Oct 2020 08:00:14 +0000 (01:00 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 Oct 2020 18:46:28 +0000 (12:46 -0600)
commit47ce030b7ac5a5259a9a5919f230b52497afc31a
tree0e36f94f3e3c2a877385be2e851c02f36a7fcde3
parentc728152413312de6c95731a845d30c9ae735d656
blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue

blk_exit_queue will free elevator_data, while blk_mq_run_work_fn
will access it. Move cancel of hctx->run_work to the front of
blk_exit_queue to avoid use-after-free.

Fixes: 1b97871b501f ("blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release")
Signed-off-by: Yang Yang <yang.yang@vivo.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sysfs.c
block/blk-sysfs.c