aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrabhath Sajeepa <psajeepa@purestorage.com>2018-11-28 13:11:29 -0500
committerChristoph Hellwig <hch@lst.de>2018-11-30 11:23:23 -0500
commit6344d02dc8f886b6bbcd922ae1a17e4a41500f2d (patch)
tree4218580933ba66ea2ec7ebe0da102e1b96ee7b66
parentf6c8e432cb0479255322c5d0335b9f1699a0270c (diff)
nvme-rdma: fix double freeing of async event data
Some error paths in configuration of admin queue free data buffer associated with async request SQE without resetting the data buffer pointer to NULL, This buffer is also freed up again if the controller is shutdown or reset. Signed-off-by: Prabhath Sajeepa <psajeepa@purestorage.com> Reviewed-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/rdma.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index d181cafedc58..ab6ec7295bf9 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -184,6 +184,7 @@ static int nvme_rdma_alloc_qe(struct ib_device *ibdev, struct nvme_rdma_qe *qe,
184 qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir); 184 qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir);
185 if (ib_dma_mapping_error(ibdev, qe->dma)) { 185 if (ib_dma_mapping_error(ibdev, qe->dma)) {
186 kfree(qe->data); 186 kfree(qe->data);
187 qe->data = NULL;
187 return -ENOMEM; 188 return -ENOMEM;
188 } 189 }
189 190
@@ -823,6 +824,7 @@ out_free_tagset:
823out_free_async_qe: 824out_free_async_qe:
824 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, 825 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
825 sizeof(struct nvme_command), DMA_TO_DEVICE); 826 sizeof(struct nvme_command), DMA_TO_DEVICE);
827 ctrl->async_event_sqe.data = NULL;
826out_free_queue: 828out_free_queue:
827 nvme_rdma_free_queue(&ctrl->queues[0]); 829 nvme_rdma_free_queue(&ctrl->queues[0]);
828 return error; 830 return error;