Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Fix error flow at nvme_rdma_configure_admin_queue()
@ 2018-06-14 12:37 Israel Rukshin
  2018-06-15  8:01 ` Christoph Hellwig
  0 siblings, 1 reply; 12+ messages in thread
From: Israel Rukshin @ 2018-06-14 12:37 UTC (permalink / raw)


On error calling to nvme_rdma_free_queue() with admin queue
frees the QE before it was allocated.

Signed-off-by: Israel Rukshin <israelr at mellanox.com>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/rdma.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 7b3f084..8786779 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -536,6 +536,15 @@ static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl,
 		goto out_destroy_cm_id;
 	}
 
+	if (idx == 0) {
+		ret = nvme_rdma_alloc_qe(queue->device->dev,
+					 &ctrl->async_event_sqe,
+					 sizeof(struct nvme_command),
+					 DMA_TO_DEVICE);
+		if (ret)
+			goto out_destroy_cm_id;
+	}
+
 	set_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags);
 
 	return 0;
@@ -795,12 +804,6 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
 	if (error)
 		goto out_stop_queue;
 
-	error = nvme_rdma_alloc_qe(ctrl->queues[0].device->dev,
-			&ctrl->async_event_sqe, sizeof(struct nvme_command),
-			DMA_TO_DEVICE);
-	if (error)
-		goto out_stop_queue;
-
 	return 0;
 
 out_stop_queue:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-06-19 16:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14 12:37 [PATCH] nvme: Fix error flow at nvme_rdma_configure_admin_queue() Israel Rukshin
2018-06-15  8:01 ` Christoph Hellwig
2018-06-17 10:52   ` Max Gurtovoy
2018-06-19  5:41     ` Christoph Hellwig
2018-06-19 10:36       ` Sagi Grimberg
2018-06-19 12:09         ` Max Gurtovoy
2018-06-19 12:30           ` Sagi Grimberg
2018-06-19 16:08             ` Max Gurtovoy
2018-06-19 16:12               ` Sagi Grimberg
2018-06-19 16:21                 ` Max Gurtovoy
2018-06-19 16:38                   ` Sagi Grimberg
2018-06-19 11:57       ` Max Gurtovoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox