patch 'graph: fix node objects allocation' has been queued to stable release 20.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Nov 3 10:27:57 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.7

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/05/22. 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

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

Thanks.

Luca Boccassi

---
>From a82580c633eb1c63500b2a9a3b1004d8fbca5231 Mon Sep 17 00:00:00 2001
From: Zhirun Yan <zhirun.yan at intel.com>
Date: Thu, 4 Aug 2022 14:02:41 +0800
Subject: [PATCH] graph: fix node objects allocation

[ upstream commit afe67d1414a81004eae5a50561c724a36b025960 ]

For __rte_node_enqueue_prologue(), if the number of objs is more than
the node->size * 2, the extra objs will write out of bounds memory.
It should use __rte_node_stream_alloc_size() to request enough memory.

And for rte_node_next_stream_put(), it will re-allocate a small size,
when the node free space is small and new objs is less than the current
node->size. Some objs pointers behind new size may be lost. And it will
cause memory leak. It should request enough size of memory, containing
the original objs and new objs at least.

Fixes: 40d4f51403ec ("graph: implement fastpath routines")

Signed-off-by: Zhirun Yan <zhirun.yan at intel.com>
Signed-off-by: Cunming Liang <cunming.liang at intel.com>
Acked-by: Jerin Jacob <jerinj at marvell.com>
---
 lib/librte_graph/rte_graph_worker.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_graph/rte_graph_worker.h b/lib/librte_graph/rte_graph_worker.h
index 0c0b9c095a..6dc7461659 100644
--- a/lib/librte_graph/rte_graph_worker.h
+++ b/lib/librte_graph/rte_graph_worker.h
@@ -224,7 +224,7 @@ __rte_node_enqueue_prologue(struct rte_graph *graph, struct rte_node *node,
 		__rte_node_enqueue_tail_update(graph, node);
 
 	if (unlikely(node->size < (idx + space)))
-		__rte_node_stream_alloc(graph, node);
+		__rte_node_stream_alloc_size(graph, node, node->size + space);
 }
 
 /**
@@ -432,7 +432,7 @@ rte_node_next_stream_get(struct rte_graph *graph, struct rte_node *node,
 	uint16_t free_space = node->size - idx;
 
 	if (unlikely(free_space < nb_objs))
-		__rte_node_stream_alloc_size(graph, node, nb_objs);
+		__rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
 
 	return &node->objs[idx];
 }
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-11-03 09:27:31.541879744 +0000
+++ 0099-graph-fix-node-objects-allocation.patch	2022-11-03 09:27:25.569426235 +0000
@@ -1 +1 @@
-From afe67d1414a81004eae5a50561c724a36b025960 Mon Sep 17 00:00:00 2001
+From a82580c633eb1c63500b2a9a3b1004d8fbca5231 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit afe67d1414a81004eae5a50561c724a36b025960 ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
- lib/graph/rte_graph_worker.h | 4 ++--
+ lib/librte_graph/rte_graph_worker.h | 4 ++--
@@ -26 +27 @@
-diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h
+diff --git a/lib/librte_graph/rte_graph_worker.h b/lib/librte_graph/rte_graph_worker.h
@@ -28,2 +29,2 @@
---- a/lib/graph/rte_graph_worker.h
-+++ b/lib/graph/rte_graph_worker.h
+--- a/lib/librte_graph/rte_graph_worker.h
++++ b/lib/librte_graph/rte_graph_worker.h


More information about the stable mailing list