net/mlx5e: MACsec, fix memory leak when MACsec device is deleted
authorRaed Salem <raeds@nvidia.com>
Sun, 30 Oct 2022 15:16:58 +0000 (17:16 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 24 Nov 2022 08:03:22 +0000 (00:03 -0800)
commit9b9e23c4dc2b632ece44c68ce6aebc0bf841d6a2
tree5e16156676229d90099228aa4931534a1d9437c3
parent813115c4669d74cdf6fc253c5a1768d1202073c3
net/mlx5e: MACsec, fix memory leak when MACsec device is deleted

When the MACsec netdevice is deleted, all related Rx/Tx HW/SW
states should be released/deallocated, however currently part
of the Rx security channel association data is not cleaned
properly, hence the memory leaks.

Fix by make sure all related Rx Sc resources are cleaned/freed,
while at it improve code by grouping release SC context in a
function so it can be used in both delete MACsec device and
delete Rx SC operations.

Fixes: 5a39816a75e5 ("net/mlx5e: Add MACsec offload SecY support")
Signed-off-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Emeel Hakim <ehakim@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c