[dpdk-stable] patch 'net/mlx5: fix memory free on queue create error' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Fri Jun 21 18:45:53 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/26/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/4abc36975cb000a215cf201f2c018d83e75d3f2d

Thanks.

Kevin Traynor

---
>From 4abc36975cb000a215cf201f2c018d83e75d3f2d Mon Sep 17 00:00:00 2001
From: Dekel Peled <dekelp at mellanox.com>
Date: Mon, 20 May 2019 11:07:26 +0300
Subject: [PATCH] net/mlx5: fix memory free on queue create error

[ upstream commit 9e444764487748d28adb9b57e75452ea8c3c9945 ]

In function mlx5_rxq_ibv_new(), pointer *tmpl allocation is attempted
at the start, but not validated or freed in case of error.
In function mlx5_txq_ibv_new(), pointer *txq_ibv allocation is
attempted at the start, but not freed in case of error.

This patch adds pointers initialization, validation and freeing.

Fixes: 09cb5b581762 ("net/mlx5: separate DPDK from verbs Rx queue objects")
Fixes: faf2667fe8d5 ("net/mlx5: separate DPDK from verbs Tx queue objects")

Signed-off-by: Dekel Peled <dekelp at mellanox.com>
Acked-by: Ori Kam <orika at mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 22 +++++++++++++---------
 drivers/net/mlx5/mlx5_txq.c |  4 +++-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index f48b5512d..416c07342 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -778,5 +778,5 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
 	unsigned int cqe_n;
 	unsigned int wqe_n = 1 << rxq_data->elts_n;
-	struct mlx5_rxq_ibv *tmpl;
+	struct mlx5_rxq_ibv *tmpl = NULL;
 	struct mlx5dv_cq cq_info;
 	struct mlx5dv_rwq rwq;
@@ -1019,13 +1019,17 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
 	return tmpl;
 error:
-	ret = rte_errno; /* Save rte_errno before cleanup. */
-	if (tmpl->wq)
-		claim_zero(mlx5_glue->destroy_wq(tmpl->wq));
-	if (tmpl->cq)
-		claim_zero(mlx5_glue->destroy_cq(tmpl->cq));
-	if (tmpl->channel)
-		claim_zero(mlx5_glue->destroy_comp_channel(tmpl->channel));
+	if (tmpl) {
+		ret = rte_errno; /* Save rte_errno before cleanup. */
+		if (tmpl->wq)
+			claim_zero(mlx5_glue->destroy_wq(tmpl->wq));
+		if (tmpl->cq)
+			claim_zero(mlx5_glue->destroy_cq(tmpl->cq));
+		if (tmpl->channel)
+			claim_zero(mlx5_glue->destroy_comp_channel
+							(tmpl->channel));
+		rte_free(tmpl);
+		rte_errno = ret; /* Restore rte_errno. */
+	}
 	priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
-	rte_errno = ret; /* Restore rte_errno. */
 	return NULL;
 }
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index c5a3d1b4c..2971f9aa2 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -360,5 +360,5 @@ mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
 		container_of(txq_data, struct mlx5_txq_ctrl, txq);
 	struct mlx5_txq_ibv tmpl;
-	struct mlx5_txq_ibv *txq_ibv;
+	struct mlx5_txq_ibv *txq_ibv = NULL;
 	union {
 		struct ibv_qp_init_attr_ex init;
@@ -544,4 +544,6 @@ error:
 	if (tmpl.qp)
 		claim_zero(mlx5_glue->destroy_qp(tmpl.qp));
+	if (txq_ibv)
+		rte_free(txq_ibv);
 	priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
 	rte_errno = ret; /* Restore rte_errno. */
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-06-21 17:22:12.221669119 +0100
+++ 0009-net-mlx5-fix-memory-free-on-queue-create-error.patch	2019-06-21 17:22:11.719519217 +0100
@@ -1 +1 @@
-From 9e444764487748d28adb9b57e75452ea8c3c9945 Mon Sep 17 00:00:00 2001
+From 4abc36975cb000a215cf201f2c018d83e75d3f2d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9e444764487748d28adb9b57e75452ea8c3c9945 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -25 +26 @@
-index 3330057fa..e04a4718e 100644
+index f48b5512d..416c07342 100644
@@ -28 +29 @@
-@@ -844,5 +844,5 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
+@@ -778,5 +778,5 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
@@ -35 +36 @@
-@@ -1085,13 +1085,17 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
+@@ -1019,13 +1019,17 @@ mlx5_rxq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
@@ -62 +63 @@
-index 50b1f810a..289024c4c 100644
+index c5a3d1b4c..2971f9aa2 100644
@@ -65 +66 @@
-@@ -402,5 +402,5 @@ mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
+@@ -360,5 +360,5 @@ mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
@@ -72 +73 @@
-@@ -587,4 +587,6 @@ error:
+@@ -544,4 +544,6 @@ error:


More information about the stable mailing list