Commit 24e412c1 authored by Michal Kalderon's avatar Michal Kalderon Committed by Jason Gunthorpe

RDMA/qedr: Fix memory leak in user qp and mr

User QPs pbl's weren't freed properly.
MR pbls weren't freed properly.

Fixes: e0290cce ("qedr: Add support for memory registeration verbs")
Link: https://lore.kernel.org/r/20191027200451.28187-5-michal.kalderon@marvell.comSigned-off-by: default avatarAriel Elior <ariel.elior@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 82af6d19
......@@ -1581,6 +1581,14 @@ static void qedr_cleanup_user(struct qedr_dev *dev, struct qedr_qp *qp)
ib_umem_release(qp->urq.umem);
qp->urq.umem = NULL;
if (rdma_protocol_roce(&dev->ibdev, 1)) {
qedr_free_pbl(dev, &qp->usq.pbl_info, qp->usq.pbl_tbl);
qedr_free_pbl(dev, &qp->urq.pbl_info, qp->urq.pbl_tbl);
} else {
kfree(qp->usq.pbl_tbl);
kfree(qp->urq.pbl_tbl);
}
}
static int qedr_create_user_qp(struct qedr_dev *dev,
......@@ -2689,8 +2697,8 @@ int qedr_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata)
dev->ops->rdma_free_tid(dev->rdma_ctx, mr->hw_mr.itid);
if ((mr->type != QEDR_MR_DMA) && (mr->type != QEDR_MR_FRMR))
qedr_free_pbl(dev, &mr->info.pbl_info, mr->info.pbl_table);
if (mr->type != QEDR_MR_DMA)
free_mr_info(dev, &mr->info);
/* it could be user registered memory. */
ib_umem_release(mr->umem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment