* [PATCH] nvme/pci: Fix queue double allocations
@ 2018-01-23 16:16 Keith Busch
2018-01-23 19:15 ` Christoph Hellwig
2018-01-24 6:29 ` Sagi Grimberg
0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2018-01-23 16:16 UTC (permalink / raw)
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 at intel.com>
---
drivers/nvme/host/pci.c | 3 +++
1 file changed, 3 insertions(+)
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,
{
struct nvme_queue *nvmeq = &dev->queues[qid];
+ if (dev->ctrl.queue_count > qid)
+ return 0;
+
nvmeq->cqes = dma_zalloc_coherent(dev->dev, CQ_SIZE(depth),
&nvmeq->cq_dma_addr, GFP_KERNEL);
if (!nvmeq->cqes)
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] nvme/pci: Fix queue double allocations
2018-01-23 16:16 [PATCH] nvme/pci: Fix queue double allocations Keith Busch
@ 2018-01-23 19:15 ` Christoph Hellwig
2018-01-24 6:29 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2018-01-23 19:15 UTC (permalink / raw)
Thanks,
applied to nvme-4.16.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] nvme/pci: Fix queue double allocations
2018-01-23 16:16 [PATCH] nvme/pci: Fix queue double allocations Keith Busch
2018-01-23 19:15 ` Christoph Hellwig
@ 2018-01-24 6:29 ` Sagi Grimberg
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2018-01-24 6:29 UTC (permalink / raw)
> 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 at intel.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
I wish we wouldn't have to rely on nvme_alloc_queue for this though..
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-24 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-23 16:16 [PATCH] nvme/pci: Fix queue double allocations Keith Busch
2018-01-23 19:15 ` Christoph Hellwig
2018-01-24 6:29 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox