[PATCH resend 2/3] nvme-pci: allocate device queues storage space at probe

Keith Busch keith.busch at intel.com
Tue Jan 23 08:06:42 PST 2018


On Sun, Jan 14, 2018 at 12:39:01PM +0200, Sagi Grimberg wrote:
> @@ -1590,14 +1580,12 @@ static int nvme_pci_configure_admin_queue(struct nvme_dev *dev)
>  	if (result < 0)
>  		return result;
>  
> -	nvmeq = dev->queues[0];
> -	if (!nvmeq) {
> -		nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH,
> -					dev_to_node(dev->dev));
> -		if (!nvmeq)
> -			return -ENOMEM;
> -	}
> +	result = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH,
> +			dev_to_node(dev->dev));
> +	if (result)
> +		return result;
>  
> +	nvmeq = &dev->queues[0];
>  	aqa = nvmeq->q_depth - 1;
>  	aqa |= aqa << 16;

This is reallocting the admin queue on each reset, leaking the previous
allocation's SQ/CQ memory, then creates an incorrect queue_count. This
was already applied, so I'll send a quick fix.



More information about the Linux-nvme mailing list