Skip to content

Commit 1993519

Browse files
selvintxavierdledford
authored andcommitted
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 <[email protected]> Signed-off-by: Somnath Kotur <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 74828b1 commit 1993519

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr)
30663066
return rc;
30673067
}
30683068

3069-
if (mr->npages && mr->pages) {
3069+
if (mr->pages) {
30703070
rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res,
30713071
&mr->qplib_frpl);
30723072
kfree(mr->pages);

0 commit comments

Comments
 (0)