Commit ee30cb5b authored by Roland Dreier's avatar Roland Dreier

RDMA/amso1100: Fix memory leak in c2_reg_phys_mr()

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: default avatarRoland Dreier <rolandd@cisco.com>
parent 44334bd9
...@@ -390,8 +390,10 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd, ...@@ -390,8 +390,10 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
} }
mr = kmalloc(sizeof(*mr), GFP_KERNEL); mr = kmalloc(sizeof(*mr), GFP_KERNEL);
if (!mr) if (!mr) {
vfree(page_list);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
mr->pd = to_c2pd(ib_pd); mr->pd = to_c2pd(ib_pd);
pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, " pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment