Skip to content

Commit

Permalink
IB/mlx5: Fix memory leak in query device
Browse files Browse the repository at this point in the history
We need to free dev->port when we fail to enable RoCE or
initialize node data.

Fixes: 0837e86 ('IB/mlx5: Add per port counters')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Majd Dibbiny authored and Doug Ledford committed Nov 17, 2016
1 parent 3c7ba57 commit 90be7c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/mlx5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3115,7 +3115,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);
Expand All @@ -3125,7 +3125,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);
Expand Down

0 comments on commit 90be7c8

Please sign in to comment.