]> git.hungrycats.org Git - linux/commitdiff
IB/mlx4: Fix memory leak in __mlx4_ib_modify_qp
authorMajd Dibbiny <majd@mellanox.com>
Thu, 29 Jan 2015 08:41:41 +0000 (10:41 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Tue, 24 Mar 2015 01:02:45 +0000 (21:02 -0400)
commit bede98e781747623ae170667694a71ef19c6ba7f upstream.

In case handle_eth_ud_smac_index fails, we need to free the allocated resources.

Fixes: 2f5bb473681b ("mlx4: Add ref counting to port MAC table for RoCE")
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/infiniband/hw/mlx4/qp.c

index 9c5150c3cb311a147195eab8f8a7b9290e6629fd..03045dd9e5decfeefbef3e43c5b955c5c4b70150 100644 (file)
@@ -1669,8 +1669,10 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
                            qp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI ||
                            qp->mlx4_ib_qp_type == MLX4_IB_QPT_TUN_GSI) {
                                err = handle_eth_ud_smac_index(dev, qp, (u8 *)attr->smac, context);
-                               if (err)
-                                       return -EINVAL;
+                               if (err) {
+                                       err = -EINVAL;
+                                       goto out;
+                               }
                                if (qp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI)
                                        dev->qp1_proxy[qp->port - 1] = qp;
                        }