Skip to content

Commit 597a1ca

Browse files
zhengchaoshaoBrian Maly
authored andcommitted
net/mlx5e: fix double free in macsec_fs_tx_create_crypto_table_groups
In function macsec_fs_tx_create_crypto_table_groups(), when the ft->g memory is successfully allocated but the 'in' memory fails to be allocated, the memory pointed to by ft->g is released once. And in function macsec_fs_tx_create(), macsec_fs_tx_destroy() is called to release the memory pointed to by ft->g again. This will cause double free problem. Fixes: e467b28 ("net/mlx5e: Add MACsec TX steering rules") Signed-off-by: Zhengchao Shao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Orabug: 35622106 (cherry picked from commit aeb6601) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: aeb6601 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 1aa621b commit 597a1ca

File tree

1 file changed

+1
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+1
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ static int macsec_fs_tx_create_crypto_table_groups(struct mlx5e_flow_table *ft)
161161

162162
if (!in) {
163163
kfree(ft->g);
164+
ft->g = NULL;
164165
return -ENOMEM;
165166
}
166167

0 commit comments

Comments
 (0)