Skip to content

Commit

Permalink
RDMA/amso1100: Fix memory leak in c2_reg_phys_mr()
Browse files Browse the repository at this point in the history
If the allocation of mr fails, then c2_reg_phys_mr() leaks the
page_list array it allocated earlier.

This was Coverity CID #1413.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Roland Dreier committed Sep 28, 2006
1 parent 44334bd commit ee30cb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/infiniband/hw/amso1100/c2_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,10 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
}

mr = kmalloc(sizeof(*mr), GFP_KERNEL);
if (!mr)
if (!mr) {
vfree(page_list);
return ERR_PTR(-ENOMEM);
}

mr->pd = to_c2pd(ib_pd);
pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, "
Expand Down

0 comments on commit ee30cb5

Please sign in to comment.