aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-09-28 13:44:07 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-28 13:44:07 -0400
commitee30cb5b0b65392843cc3beaba48160ee4a3764e (patch)
treec996c2327d3986d2a06e3a1352aa8774394aadca
parent44334bd97e76662c5f40c629357e6acc4dee3e8a (diff)
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: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/amso1100/c2_provider.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index 622d6f1f920..da98d9f7142 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -390,8 +390,10 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
390 } 390 }
391 391
392 mr = kmalloc(sizeof(*mr), GFP_KERNEL); 392 mr = kmalloc(sizeof(*mr), GFP_KERNEL);
393 if (!mr) 393 if (!mr) {
394 vfree(page_list);
394 return ERR_PTR(-ENOMEM); 395 return ERR_PTR(-ENOMEM);
396 }
395 397
396 mr->pd = to_c2pd(ib_pd); 398 mr->pd = to_c2pd(ib_pd);
397 pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, " 399 pr_debug("%s - page shift %d, pbl_depth %d, total_len %u, "