mirror of https://gitee.com/openkylin/linux.git
net/mlx5e: Fix memory leak if refreshing TIRs fails
Free 'in' command object also when mlx5_core_modify_tir fails.
Fixes: 724b2aa151
("net/mlx5e: TIRs management refactoring")
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c8cf78fe10
commit
bf50082c15
|
@ -139,7 +139,7 @@ int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5_core_dev *mdev)
|
||||||
struct mlx5e_tir *tir;
|
struct mlx5e_tir *tir;
|
||||||
void *in;
|
void *in;
|
||||||
int inlen;
|
int inlen;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
|
inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
|
||||||
in = mlx5_vzalloc(inlen);
|
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) {
|
list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) {
|
||||||
err = mlx5_core_modify_tir(mdev, tir->tirn, in, inlen);
|
err = mlx5_core_modify_tir(mdev, tir->tirn, in, inlen);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
kvfree(in);
|
kvfree(in);
|
||||||
|
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue