crypto/mlx5: fix freeing on probing failure
authorRaja Zidane <rzidane@nvidia.com>
Mon, 8 Nov 2021 13:09:19 +0000 (13:09 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 8 Nov 2021 18:46:28 +0000 (19:46 +0100)
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>
drivers/crypto/mlx5/mlx5_crypto_dek.c

index de0d254..472ee37 100644 (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;
+       }
 }