lkml.org 
[lkml]   [2021]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 19/28] nvme-loop: reset queue count to 1 in nvme_loop_destroy_io_queues()
    Date
    From: Hannes Reinecke <hare@suse.de>

    [ Upstream commit a6c144f3d2e230f2b3ac5ed8c51e0f0391556197 ]

    The queue count is increased in nvme_loop_init_io_queues(), so we
    need to reset it to 1 at the end of nvme_loop_destroy_io_queues().
    Otherwise the function is not re-entrant safe, and crash will happen
    during concurrent reset and remove calls.

    Signed-off-by: Hannes Reinecke <hare@suse.de>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/nvme/target/loop.c | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
    index 82b87a4c50f6..b4f5503ae570 100644
    --- a/drivers/nvme/target/loop.c
    +++ b/drivers/nvme/target/loop.c
    @@ -288,6 +288,7 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl)
    clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags);
    nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
    }
    + ctrl->ctrl.queue_count = 1;
    }

    static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl)
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-06-16 17:35    [W:4.179 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site