DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: dev@dpdk.org
Cc: Matan Azrad <matan@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [dpdk-dev] [PATCH 7/7] regex/mlx5: fix QP setuping error flow
Date: Wed, 18 Nov 2020 17:00:11 +0000	[thread overview]
Message-ID: <1605718811-18652-7-git-send-email-michaelba@nvidia.com> (raw)
In-Reply-To: <1605718811-18652-1-git-send-email-michaelba@nvidia.com>

In regex QP setup, the PMD creates some SQ objects.

When SQ object creation is failed, the previous SQ objects memory were
not freed what caused a memory leak.

Free them.

Fixes: 54fa1f6a67d7 ("regex/mlx5: add teardown for fastpath buffers")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/regex/mlx5/mlx5_regex_control.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 88b3d1a..d6f452b 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -336,6 +336,7 @@
 	struct mlx5_regex_priv *priv = dev->data->dev_private;
 	struct mlx5_regex_qp *qp;
 	int i;
+	int nb_sq_config = 0;
 	int ret;
 	uint16_t log_desc;
 
@@ -364,8 +365,9 @@
 		ret = regex_ctrl_create_sq(priv, qp, i, log_desc);
 		if (ret) {
 			DRV_LOG(ERR, "Can't create sq.");
-			goto err_sq;
+			goto err_btree;
 		}
+		nb_sq_config++;
 	}
 
 	ret = mlx5_mr_btree_init(&qp->mr_ctrl.cache_bh, MLX5_MR_BTREE_CACHE_N,
@@ -385,9 +387,8 @@
 err_fp:
 	mlx5_mr_btree_free(&qp->mr_ctrl.cache_bh);
 err_btree:
-	for (i = 0; i < qp->nb_obj; i++)
+	for (i = 0; i < nb_sq_config; i++)
 		regex_ctrl_destroy_sq(priv, qp, i);
-err_sq:
 	regex_ctrl_destroy_cq(priv, &qp->cq);
 err_cq:
 	rte_free(qp->sqs);
-- 
1.8.3.1


  parent reply	other threads:[~2020-11-18 17:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 17:00 [dpdk-dev] [PATCH 1/7] regex/mlx5: fix jump to the wrong label Michael Baum
2020-11-18 17:00 ` [dpdk-dev] [PATCH 2/7] regex/mlx5: fix iterator type in RXP engines management Michael Baum
2020-11-18 17:00 ` [dpdk-dev] [PATCH 3/7] regex/mlx5: fix unnecessary init in RXP handle Michael Baum
2020-11-18 17:00 ` [dpdk-dev] [PATCH 4/7] regex/mlx5: fix unchecked return value " Michael Baum
2020-11-18 17:00 ` [dpdk-dev] [PATCH 5/7] regex/mlx5: improve error messages in RXP rules flush Michael Baum
2020-11-18 17:00 ` [dpdk-dev] [PATCH 6/7] regex/mlx5: improve constants type in QP buffers creation Michael Baum
2020-11-22 13:58   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-11-18 17:00 ` Michael Baum [this message]
2020-11-22 14:06 ` [dpdk-dev] [dpdk-stable] [PATCH 1/7] regex/mlx5: fix jump to the wrong label 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=1605718811-18652-7-git-send-email-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=viacheslavo@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).