[dpdk-stable] patch 'graph: fix memory leak in stats' has been queued to stable release 20.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 12 15:03:56 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.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 07/14/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/3d328cf711b9f6948a49d2258bc0809de30002e1

Thanks.

Luca Boccassi

---
>From 3d328cf711b9f6948a49d2258bc0809de30002e1 Mon Sep 17 00:00:00 2001
From: Hongbo Zheng <zhenghongbo3 at huawei.com>
Date: Thu, 6 May 2021 15:16:26 +0800
Subject: [PATCH] graph: fix memory leak in stats

[ upstream commit 3b47572fbe783ced8264bc7de459121e201c5bef ]

Fix function 'stats_mem_populate' return without
free dynamic memory referenced by 'stats'.

Fixes: af1ae8b6a32c ("graph: implement stats")

Signed-off-by: Hongbo Zheng <zhenghongbo3 at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 lib/librte_graph/graph_stats.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_graph/graph_stats.c b/lib/librte_graph/graph_stats.c
index 125e08d732..30e295d8b1 100644
--- a/lib/librte_graph/graph_stats.c
+++ b/lib/librte_graph/graph_stats.c
@@ -165,6 +165,7 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in,
 	stats = realloc(stats, stats->sz + stats->cluster_node_size);
 	if (stats == NULL)
 		SET_ERR_JMP(ENOMEM, err, "Realloc failed");
+	*stats_in = NULL;
 
 	/* Clear the new struct cluster_node area */
 	cluster = RTE_PTR_ADD(stats, stats->sz),
@@ -174,7 +175,7 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in,
 	cluster->stat.hz = rte_get_timer_hz();
 	node = graph_node_id_to_ptr(graph, id);
 	if (node == NULL)
-		SET_ERR_JMP(ENOENT, err, "Failed to find node %s in graph %s",
+		SET_ERR_JMP(ENOENT, free, "Failed to find node %s in graph %s",
 			    graph_node->node->name, graph->name);
 	cluster->nodes[cluster->nb_nodes++] = node;
 
@@ -183,6 +184,8 @@ stats_mem_populate(struct rte_graph_cluster_stats **stats_in,
 	*stats_in = stats;
 
 	return 0;
+free:
+	free(stats);
 err:
 	return -rte_errno;
 }
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-07-12 13:41:36.977376606 +0100
+++ 0001-graph-fix-memory-leak-in-stats.patch	2021-07-12 13:41:36.146115445 +0100
@@ -1 +1 @@
-From 3b47572fbe783ced8264bc7de459121e201c5bef Mon Sep 17 00:00:00 2001
+From 3d328cf711b9f6948a49d2258bc0809de30002e1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3b47572fbe783ced8264bc7de459121e201c5bef ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -16 +17 @@
- lib/graph/graph_stats.c | 5 ++++-
+ lib/librte_graph/graph_stats.c | 5 ++++-
@@ -19 +20 @@
-diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
+diff --git a/lib/librte_graph/graph_stats.c b/lib/librte_graph/graph_stats.c
@@ -21,2 +22,2 @@
---- a/lib/graph/graph_stats.c
-+++ b/lib/graph/graph_stats.c
+--- a/lib/librte_graph/graph_stats.c
++++ b/lib/librte_graph/graph_stats.c


More information about the stable mailing list