From 28da58754a8ddd22cc52e6e4d11b72da24820a47 Mon Sep 17 00:00:00 2001 From: Selvin Xavier Date: Mon, 17 Sep 2018 09:05:33 -0700 Subject: [PATCH] bnxt_re: Fix couple of memory leaks that could lead to IOMMU call traces 1. DMA-able memory allocated for Shadow QP was not being freed. 2. bnxt_qplib_alloc_qp_hdr_buf() had a bug wherein the SQ pointer was erroneously pointing to the RQ. But since the corresponding free_qp_hdr_buf() was correct, memory being free was less than what was allocated. Signed-off-by: Selvin Xavier --- ...le-of-memory-leaks-that-could-lead-t.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 linux-next-cherry-picks/0046-bnxt_re-Fix-couple-of-memory-leaks-that-could-lead-t.patch diff --git a/linux-next-cherry-picks/0046-bnxt_re-Fix-couple-of-memory-leaks-that-could-lead-t.patch b/linux-next-cherry-picks/0046-bnxt_re-Fix-couple-of-memory-leaks-that-could-lead-t.patch new file mode 100644 index 0000000..d473735 --- /dev/null +++ b/linux-next-cherry-picks/0046-bnxt_re-Fix-couple-of-memory-leaks-that-could-lead-t.patch @@ -0,0 +1,45 @@ +From f40f299bbe806a2e2c8b0d7cdda822fa3bdd171b Mon Sep 17 00:00:00 2001 +From: Somnath Kotur +Date: Wed, 5 Sep 2018 13:20:34 +0530 +Subject: [PATCH] bnxt_re: Fix couple of memory leaks that could lead to IOMMU + call traces + +1. DMA-able memory allocated for Shadow QP was not being freed. +2. bnxt_qplib_alloc_qp_hdr_buf() had a bug wherein the SQ pointer was + erroneously pointing to the RQ. But since the corresponding + free_qp_hdr_buf() was correct, memory being free was less than what was + allocated. + +Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") +Signed-off-by: Somnath Kotur +Signed-off-by: Jason Gunthorpe + +diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +index bbfb86e..bc2b9e0 100644 +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +@@ -833,6 +833,8 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp) + "Failed to destroy Shadow QP"); + return rc; + } ++ bnxt_qplib_free_qp_res(&rdev->qplib_res, ++ &rdev->qp1_sqp->qplib_qp); + mutex_lock(&rdev->qp_lock); + list_del(&rdev->qp1_sqp->list); + atomic_dec(&rdev->qp_count); +diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +index e426b99..6ad0d46 100644 +--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c ++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +@@ -196,7 +196,7 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res, + struct bnxt_qplib_qp *qp) + { + struct bnxt_qplib_q *rq = &qp->rq; +- struct bnxt_qplib_q *sq = &qp->rq; ++ struct bnxt_qplib_q *sq = &qp->sq; + int rc = 0; + + if (qp->sq_hdr_buf_size && sq->hwq.max_elements) { +-- +2.5.5 + -- 2.46.0