Commit bf50082c authored by Kamal Heib's avatar Kamal Heib Committed by David S. Miller

net/mlx5e: Fix memory leak if refreshing TIRs fails

Free 'in' command object also when mlx5_core_modify_tir fails.

Fixes: 724b2aa1 ("net/mlx5e: TIRs management refactoring")
Signed-off-by: default avatarKamal Heib <kamalh@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c8cf78fe
......@@ -139,7 +139,7 @@ int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5_core_dev *mdev)
struct mlx5e_tir *tir;
void *in;
int inlen;
int err;
int err = 0;
inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
in = mlx5_vzalloc(inlen);
......@@ -151,10 +151,11 @@ int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5_core_dev *mdev)
list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) {
err = mlx5_core_modify_tir(mdev, tir->tirn, in, inlen);
if (err)
return err;
goto out;
}
out:
kvfree(in);
return 0;
return err;
}
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