summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAya Levin <ayal@mellanox.com>2019-07-07 16:57:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-28 08:28:33 +0200
commit5a637c0b0d5e37076f5fec36879016f9308a328a (patch)
tree864ba85b9060c3e4d076ed1b612022c1b5d434ca
parent98ecf34e6b82d9c04bff5cb39e9ff964f505bb79 (diff)
downloadlinux-stable-5a637c0b0d5e37076f5fec36879016f9308a328a.tar.gz
linux-stable-5a637c0b0d5e37076f5fec36879016f9308a328a.tar.bz2
linux-stable-5a637c0b0d5e37076f5fec36879016f9308a328a.zip
net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn
[ Upstream commit ef1ce7d7b67b46661091c7ccc0396186b7a247ef ] Check return value from mlx5e_attach_netdev, add error path on failure. Fixes: 48935bbb7ae8 ("net/mlx5e: IPoIB, Add netdevice profile skeleton") Signed-off-by: Aya Levin <ayal@mellanox.com> Reviewed-by: Feras Daoud <ferasda@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 4eac42555c7d..5d0783e55f42 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -698,7 +698,9 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
prof->init(mdev, netdev, prof, ipriv);
- mlx5e_attach_netdev(epriv);
+ err = mlx5e_attach_netdev(epriv);
+ if (err)
+ goto detach;
netif_carrier_off(netdev);
/* set rdma_netdev func pointers */
@@ -714,6 +716,11 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
return 0;
+detach:
+ prof->cleanup(epriv);
+ if (ipriv->sub_interface)
+ return err;
+ mlx5e_destroy_mdev_resources(mdev);
destroy_ht:
mlx5i_pkey_qpn_ht_cleanup(netdev);
return err;