DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/mlx5: fix crypto dev leak
@ 2023-11-09  7:33 Suanming Mou
  2023-11-09 20:28 ` [EXT] " Akhil Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Suanming Mou @ 2023-11-09  7:33 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, rasland

For the case crypto initialize failed, the allocated crypto dev should
be destroyed, otherwise the dev leaked. Current PMD returns directly
instead of releasing the dev.

This commit fixes the crypto dev leak when initialize failed.

Fixes: a27f6a2e1f30 ("crypto/mlx5: split AES-XTS")
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/crypto/mlx5/mlx5_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 081e96ad4d..4bac723c8b 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -383,12 +383,14 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev,
 	if (devarg_prms.is_aes_gcm) {
 		ret = mlx5_crypto_gcm_init(priv);
 		if (ret) {
+			rte_cryptodev_pmd_destroy(priv->crypto_dev);
 			DRV_LOG(ERR, "Failed to init AES-GCM crypto.");
 			return -ENOTSUP;
 		}
 	} else {
 		ret = mlx5_crypto_xts_init(priv);
 		if (ret) {
+			rte_cryptodev_pmd_destroy(priv->crypto_dev);
 			DRV_LOG(ERR, "Failed to init AES-XTS crypto.");
 			return -ENOTSUP;
 		}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [EXT] [PATCH] crypto/mlx5: fix crypto dev leak
  2023-11-09  7:33 [PATCH] crypto/mlx5: fix crypto dev leak Suanming Mou
@ 2023-11-09 20:28 ` Akhil Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2023-11-09 20:28 UTC (permalink / raw)
  To: Suanming Mou, Matan Azrad; +Cc: dev, rasland, stable

> For the case crypto initialize failed, the allocated crypto dev should
> be destroyed, otherwise the dev leaked. Current PMD returns directly
> instead of releasing the dev.
> 
> This commit fixes the crypto dev leak when initialize failed.
> 
> Fixes: a27f6a2e1f30 ("crypto/mlx5: split AES-XTS")
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Applied to dpdk-next-crypto

Cc: stable@dpdk.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-09 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09  7:33 [PATCH] crypto/mlx5: fix crypto dev leak Suanming Mou
2023-11-09 20:28 ` [EXT] " Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).