Skip to content

Commit

Permalink
nvme-loop: fix a possible use-after-free when destroying the admin queue
Browse files Browse the repository at this point in the history
we need to destroy the nvmet sq and let it finish gracefully
before continue to cleanup the queue.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
  • Loading branch information
Sagi Grimberg authored and Jens Axboe committed Apr 4, 2017
1 parent f363b08 commit d476983
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/target/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ static const struct blk_mq_ops nvme_loop_admin_mq_ops = {

static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
{
nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
blk_cleanup_queue(ctrl->ctrl.admin_q);
blk_mq_free_tag_set(&ctrl->admin_tag_set);
nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
}

static void nvme_loop_free_ctrl(struct nvme_ctrl *nctrl)
Expand Down

0 comments on commit d476983

Please sign in to comment.