diff options
author | Keith Busch <keith.busch@intel.com> | 2018-01-23 11:16:19 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-01-23 14:15:34 -0500 |
commit | 62314e405fa101dbb82563394f9dfc225e3f1167 (patch) | |
tree | 6996c5dba29363a50f5c1295c78a1f3052a6f8b8 | |
parent | 475a055e62a1eb92f4358ad8a9059df973c190ac (diff) |
nvme-pci: Fix queue double allocations
The queue count says the highest queue that's been allocated, so don't
reallocate a queue lower than that.
Fixes: 147b27e4bd0 ("nvme-pci: allocate device queues storage space at probe")
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/nvme/host/pci.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a2ffb557b616..c46c239cc1ff 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1384,6 +1384,9 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, | |||
1384 | { | 1384 | { |
1385 | struct nvme_queue *nvmeq = &dev->queues[qid]; | 1385 | struct nvme_queue *nvmeq = &dev->queues[qid]; |
1386 | 1386 | ||
1387 | if (dev->ctrl.queue_count > qid) | ||
1388 | return 0; | ||
1389 | |||
1387 | nvmeq->cqes = dma_zalloc_coherent(dev->dev, CQ_SIZE(depth), | 1390 | nvmeq->cqes = dma_zalloc_coherent(dev->dev, CQ_SIZE(depth), |
1388 | &nvmeq->cq_dma_addr, GFP_KERNEL); | 1391 | &nvmeq->cq_dma_addr, GFP_KERNEL); |
1389 | if (!nvmeq->cqes) | 1392 | if (!nvmeq->cqes) |