[PATCH] nvme-host tcp: check if the queue is allocated before stopping it

Sagi Grimberg sagi at grimberg.me
Wed Aug 10 06:03:48 PDT 2022


> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index ac74dce3e95b..ab9bb5c98c78 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1619,6 +1619,9 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
>   	struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
>   	struct nvme_tcp_queue *queue = &ctrl->queues[qid];
>   
> +	if (!test_bit(NVME_TCP_Q_ALLOCATED, &queue->flags))
> +		return;
> +
>   	mutex_lock(&queue->queue_lock);
>   	if (test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags))
>   		__nvme_tcp_stop_queue(queue);

This looks correct to me,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>



More information about the Linux-nvme mailing list