]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: move cancel of requeue_work to the front of blk_exit_queue
authorzhengbin <zhengbin13@huawei.com>
Mon, 12 Aug 2019 12:36:55 +0000 (20:36 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Aug 2019 14:14:11 +0000 (08:14 -0600)
commit0f79ef247876769b2048ed5abe751b7bef15e12c
tree502e5600f432e2a4def57d560a73788b53a14d54
parentb78e031558c21d02e12edf69a5eaee7698280131
blk-mq: move cancel of requeue_work to the front of blk_exit_queue

blk_exit_queue will free elevator_data, while blk_mq_requeue_work
will access it. Move cancel of requeue_work to the front of
blk_exit_queue to avoid use-after-free.

blk_exit_queue                blk_mq_requeue_work
  __elevator_exit               blk_mq_run_hw_queues
    blk_mq_exit_sched             blk_mq_run_hw_queue
      dd_exit_queue                 blk_mq_hctx_has_pending
        kfree(elevator_data)          blk_mq_sched_has_work
                                        dd_has_work

Fixes: 332611ae55bd ("blk-mq: move cancel of requeue_work into blk_mq_release")
Cc: stable@vger.kernel.org
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c
block/blk-sysfs.c