diff options
author | Mark Bloch <markb@mellanox.com> | 2019-02-11 17:40:54 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-02-11 15:32:29 -0700 |
commit | fc9e4477f924e84d7798f7a1d41401d699de1219 (patch) | |
tree | 1857a84546cf61953323cea4bc2a3163075a7384 /drivers/infiniband/hw/mlx5 | |
parent | 0da4d48d99dfdb2a69172079f6a56e22689d16ce (diff) | |
download | linux-stable-fc9e4477f924e84d7798f7a1d41401d699de1219.tar.gz linux-stable-fc9e4477f924e84d7798f7a1d41401d699de1219.tar.bz2 linux-stable-fc9e4477f924e84d7798f7a1d41401d699de1219.zip |
RDMA/mlx5: Fix memory leak in case we fail to add an IB device
Make sure the IB device is freed on failure.
Fixes: b5ca15ad7e61 ("IB/mlx5: Add proper representors support")
Signed-off-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5')
-rw-r--r-- | drivers/infiniband/hw/mlx5/ib_rep.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c index 6d7b8bad4b61..95ac97af6166 100644 --- a/drivers/infiniband/hw/mlx5/ib_rep.c +++ b/drivers/infiniband/hw/mlx5/ib_rep.c @@ -78,8 +78,10 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) ibdev->mdev = dev; ibdev->num_ports = max(MLX5_CAP_GEN(dev, num_ports), MLX5_CAP_GEN(dev, num_vhca_ports)); - if (!__mlx5_ib_add(ibdev, &rep_profile)) + if (!__mlx5_ib_add(ibdev, &rep_profile)) { + ib_dealloc_device(&ibdev->ib_dev); return -EINVAL; + } rep->rep_if[REP_IB].priv = ibdev; |