summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-04-12 01:43:29 +0400
committerRoland Dreier <roland@purestorage.com>2012-04-25 03:11:21 +0400
commitbf6b47deb40f9fc8ddb4573373dc9614aab59d35 (patch)
tree866e0dedc84ce00105a009b701e8801b6fbe1622 /drivers/infiniband
parent0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff)
downloadlinux-bf6b47deb40f9fc8ddb4573373dc9614aab59d35.tar.xz
IB/mlx4: Fix memory leaks in ib_link_query_port()
If the call to mlx4_MAD_IFC() fails in ib_link_query_port() we will currently do 'return err;' which will leak 'in_mad' and 'out_mad'. We should instead do 'goto out;' where we'll properly free the memory we previously allocated. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 75d305629300..cc88c9c955c9 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port,
NULL, NULL, in_mad, out_mad);
if (err)
- return err;
+ goto out;
/* Checking LinkSpeedActive for FDR-10 */
if (out_mad->data[15] & 0x1)