diff options
author | Selvin Xavier <selvin.xavier@broadcom.com> | 2017-08-31 09:27:34 +0530 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-09-22 13:57:33 -0400 |
commit | 1993519be8bc86342687c61d8d11c3ade62b3b84 (patch) | |
tree | db6cbdbbb27b17c695418327fea93e00b934a15f | |
parent | 74828b128115033ff25d4140d732a05a36eaeaf0 (diff) | |
download | linux-1993519be8bc86342687c61d8d11c3ade62b3b84.tar.gz linux-1993519be8bc86342687c61d8d11c3ade62b3b84.tar.bz2 linux-1993519be8bc86342687c61d8d11c3ade62b3b84.zip |
bnxt_re: Fix memory leak in FRMR path
This patch fixes a memory leak issue when alloc_mr is used.
mr->pages and mr->npages are used only in alloc_mr path. mr->pages
is allocated when alloc_mr is called or in the case of FRMR, while
creating the MR. mr->npages is updated only when the MR created
is used i.e. after invoking map_mr_sg verb, before data transfer.
In the dereg_mr path, if mr->npages is 0, driver ends up not freeing
the memory created.
Removing the npages check from the dereg_mr path for kernel consumers.
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 7430ef07a0e1..d7be4e4227ce 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3066,7 +3066,7 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) return rc; } - if (mr->npages && mr->pages) { + if (mr->pages) { rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res, &mr->qplib_frpl); kfree(mr->pages); |