DPDK patches and discussions
 help / color / mirror / Atom feed
From: Suanming Mou <suanmingm@nvidia.com>
To: Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>
Subject: [PATCH] crypto/mlx5: fix crypto dev leak
Date: Thu, 9 Nov 2023 15:33:17 +0800	[thread overview]
Message-ID: <20231109073317.1311513-1-suanmingm@nvidia.com> (raw)

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


             reply	other threads:[~2023-11-09  7:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09  7:33 Suanming Mou [this message]
2023-11-09 20:28 ` [EXT] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231109073317.1311513-1-suanmingm@nvidia.com \
    --to=suanmingm@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).