net/mlx5e: Fix MACsec initialization error path

Currently MACsec initialization error path does not
destroy sci hash table in case of failure.
Fix by destroying hash table in case of failure.

Fixes: 9515978eee ("net/mlx5e: Implement MACsec Tx data path using MACsec skb_metadata_dst")
Signed-off-by: Emeel Hakim <ehakim@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Emeel Hakim 2022-09-21 11:10:47 -07:00 committed by Jakub Kicinski
parent 21803630c4
commit 6c5e0b25db
1 changed files with 3 additions and 1 deletions

View File

@ -1285,7 +1285,7 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv)
if (err) { if (err) {
mlx5_core_err(mdev, "MACsec offload: Failed to init SCI hash table, err=%d\n", mlx5_core_err(mdev, "MACsec offload: Failed to init SCI hash table, err=%d\n",
err); err);
goto err_out; goto err_hash;
} }
xa_init_flags(&macsec->sc_xarray, XA_FLAGS_ALLOC1); xa_init_flags(&macsec->sc_xarray, XA_FLAGS_ALLOC1);
@ -1307,6 +1307,8 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv)
return 0; return 0;
err_out: err_out:
rhashtable_destroy(&macsec->sci_hash);
err_hash:
mlx5_core_dealloc_pd(priv->mdev, macsec->aso_pdn); mlx5_core_dealloc_pd(priv->mdev, macsec->aso_pdn);
err_pd: err_pd:
kfree(macsec); kfree(macsec);