aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Jaeger <christophjaeger@linux.com>2014-04-21 17:02:42 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-06 18:59:09 -0700
commitbbac87fb33da122c392e911706c6503c208e8eec (patch)
tree17bf0988c2c66539b45c9efd2470494f62c7dd1c
parentb03a0751eb1039340c843411cd2f09859531a385 (diff)
RDMA/cxgb4: Fix memory leaks in c4iw_alloc() error paths
commit 65b302ad31b02b0790417f4e65833af494cb35ce upstream. c4iw_alloc() bails out without freeing the storage that 'devp' points to. Picked up by Coverity - CID 1204241. Fixes: fa658a98a2 ("RDMA/cxgb4: Use the BAR2/WC path for kernel QPs and T5 devices") Signed-off-by: Christoph Jaeger <christophjaeger@linux.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index f4fa50a609e..8914ea90ddd 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -736,6 +736,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
pci_resource_len(devp->rdev.lldi.pdev, 2));
if (!devp->rdev.bar2_kva) {
pr_err(MOD "Unable to ioremap BAR2\n");
+ ib_dealloc_device(&devp->ibdev);
return ERR_PTR(-EINVAL);
}
} else if (ocqp_supported(infop)) {
@@ -747,6 +748,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
devp->rdev.lldi.vr->ocq.size);
if (!devp->rdev.oc_mw_kva) {
pr_err(MOD "Unable to ioremap onchip mem\n");
+ ib_dealloc_device(&devp->ibdev);
return ERR_PTR(-EINVAL);
}
}