Commit 32091ee6 authored by Majd Dibbiny's avatar Majd Dibbiny Committed by Greg Kroah-Hartman

IB/mlx5: Fix memory leak in query device

commit 90be7c8a upstream.

We need to free dev->port when we fail to enable RoCE or
initialize node data.

Fixes: 0837e86a ('IB/mlx5: Add per port counters')
Signed-off-by: default avatarMajd Dibbiny <majd@mellanox.com>
Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21822a5b
......@@ -2835,7 +2835,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
}
err = init_node_data(dev);
if (err)
goto err_dealloc;
goto err_free_port;
mutex_init(&dev->flow_db.lock);
mutex_init(&dev->cap_mask_mutex);
......@@ -2845,7 +2845,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
if (ll == IB_LINK_LAYER_ETHERNET) {
err = mlx5_enable_roce(dev);
if (err)
goto err_dealloc;
goto err_free_port;
}
err = create_dev_resources(&dev->devr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment