]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 16 Oct 2019 09:55:15 +0000 (11:55 +0200)
commit84607af9cc4739ee4c89dd854f451ac94dbe368d
tree2375d5bb2beb77741843c772cf845b810bbbb58f
parent0e5f62756bbdb794dd571a5d6bf9c4f59c86eca3
blk-mq: move cancel of requeue_work to the front of blk_exit_queue

BugLink: https://bugs.launchpad.net/bugs/1847155
[ Upstream commit e26cc08265dda37d2acc8394604f220ef412299d ]

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: fbc2a15e3433 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
block/blk-mq.c
block/blk-sysfs.c