[dpdk-stable] patch 'net/mlx5: fix memory leak on context allocation failure' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:29:19 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/5d3374aff1b527d7421339ec1c1017e82ee63400

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 5d3374aff1b527d7421339ec1c1017e82ee63400 Mon Sep 17 00:00:00 2001
From: Michael Baum <michaelba at nvidia.com>
Date: Sun, 12 Sep 2021 13:36:23 +0300
Subject: [PATCH] net/mlx5: fix memory leak on context allocation failure
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit c76db6a4964e91a79d877a009d15d5c62507136a ]

In shared device context creation, there is a missing validation when
one of the btree memory allocation fails that will cause a memory leak.

This adds a proper check to clean resources in case of failure.

Fixes: 632f0f19056f ("net/mlx5: manage shared counters in three-level table")

Signed-off-by: Michael Baum <michaelba at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 drivers/net/mlx5/mlx5.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index d6e780d50c..cb984debcc 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1021,6 +1021,8 @@ error:
 	MLX5_ASSERT(sh);
 	if (sh->cnt_id_tbl)
 		mlx5_l3t_destroy(sh->cnt_id_tbl);
+	if (sh->share_cache.cache.table)
+		mlx5_mr_btree_free(&sh->share_cache.cache);
 	if (sh->tis)
 		claim_zero(mlx5_devx_cmd_destroy(sh->tis));
 	if (sh->td)
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:05.406904962 +0800
+++ 0075-net-mlx5-fix-memory-leak-on-context-allocation-failu.patch	2021-11-10 14:17:01.837413030 +0800
@@ -1 +1 @@
-From c76db6a4964e91a79d877a009d15d5c62507136a Mon Sep 17 00:00:00 2001
+From 5d3374aff1b527d7421339ec1c1017e82ee63400 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c76db6a4964e91a79d877a009d15d5c62507136a ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
-index f84e061fe7..f0ec2d1279 100644
+index d6e780d50c..cb984debcc 100644
@@ -24 +26 @@
-@@ -1254,6 +1254,8 @@ error:
+@@ -1021,6 +1021,8 @@ error:


More information about the stable mailing list