crypto/mlx5: fix freeing on probing failure

When calling device close, unset dek is called which destroys a hash list.
In case of error during dev probe, close is called when dek hlist is not
initialized.
Ensure non null list destroy.

Fixes: 90646d6c6e22 ("crypto/mlx5: support basic operations")
Cc: stable@dpdk.org

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Raja Zidane 2021-11-08 13:09:19 +00:00 committed by Thomas Monjalon
parent 54feeab1c0
commit 56faca3bc1

View File

@ -156,6 +156,8 @@ mlx5_crypto_dek_setup(struct mlx5_crypto_priv *priv)
void
mlx5_crypto_dek_unset(struct mlx5_crypto_priv *priv)
{
mlx5_hlist_destroy(priv->dek_hlist);
priv->dek_hlist = NULL;
if (priv->dek_hlist) {
mlx5_hlist_destroy(priv->dek_hlist);
priv->dek_hlist = NULL;
}
}