Skip to content

Commit

Permalink
IB/iser: Fix possible memory leak in iser_create_frwr_pool()
Browse files Browse the repository at this point in the history
Fix leak where desc is not being freed in error flows.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Roi Dayan authored and Roland Dreier committed Sep 3, 2013
1 parent 5587856 commit 27ae2d1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/infiniband/ulp/iser/iser_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,27 @@ int iser_create_frwr_pool(struct iser_conn *ib_conn, unsigned cmds_max)
if (IS_ERR(desc->data_frpl)) {
ret = PTR_ERR(desc->data_frpl);
iser_err("Failed to allocate ib_fast_reg_page_list err=%d\n", ret);
goto err;
goto fast_reg_page_failure;
}

desc->data_mr = ib_alloc_fast_reg_mr(device->pd,
ISCSI_ISER_SG_TABLESIZE + 1);
if (IS_ERR(desc->data_mr)) {
ret = PTR_ERR(desc->data_mr);
iser_err("Failed to allocate ib_fast_reg_mr err=%d\n", ret);
ib_free_fast_reg_page_list(desc->data_frpl);
goto err;
goto fast_reg_mr_failure;
}
desc->valid = true;
list_add_tail(&desc->list, &ib_conn->fastreg.frwr.pool);
ib_conn->fastreg.frwr.pool_size++;
}

return 0;

fast_reg_mr_failure:
ib_free_fast_reg_page_list(desc->data_frpl);
fast_reg_page_failure:
kfree(desc);
err:
iser_free_frwr_pool(ib_conn);
return ret;
Expand Down

0 comments on commit 27ae2d1

Please sign in to comment.