From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] crypto/mlx5: fix driver probing error flow
Date: Thu, 29 Jul 2021 09:50:00 +0300 [thread overview]
Message-ID: <20210729065000.172793-1-michaelba@nvidia.com> (raw)
In crypto driver probing, there are two validations after context
allocation.
When one of them fails, the context structure was not freed what caused
a memory leak.
Free it.
Fixes: debb27ea3442 ("crypto/mlx5: create login object using DevX")
Fixes: e8db4413cba5 ("crypto/mlx5: add keytag configuration")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@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 ea734f4d5c..b3d5200ca3 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -1021,12 +1021,14 @@ mlx5_crypto_dev_probe(struct rte_device *dev)
ret = mlx5_crypto_parse_devargs(dev->devargs, &devarg_prms);
if (ret) {
DRV_LOG(ERR, "Failed to parse devargs.");
+ claim_zero(mlx5_glue->close_device(ctx));
return -rte_errno;
}
login = mlx5_devx_cmd_create_crypto_login_obj(ctx,
&devarg_prms.login_attr);
if (login == NULL) {
DRV_LOG(ERR, "Failed to configure login.");
+ claim_zero(mlx5_glue->close_device(ctx));
return -rte_errno;
}
crypto_dev = rte_cryptodev_pmd_create(ibv->name, dev,
--
2.25.1
next reply other threads:[~2021-07-29 6:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 6:50 Michael Baum [this message]
2021-07-30 19:23 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-07-31 9:37 ` Thomas Monjalon
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=20210729065000.172793-1-michaelba@nvidia.com \
--to=michaelba@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=stable@dpdk.org \
/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).