From 5517bd34535e4ffffb838a835bb95ddcb77e2bba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Beno=C3=AEt=20Ganne?= Date: Fri, 30 Aug 2019 16:20:12 +0200 Subject: [PATCH] vlib: fix old nodes vector overflow in refork MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Type: fix Change-Id: I81c4cf0ce87288bb2d3c7b9f31e9419290d588b4 Signed-off-by: Benoît Ganne --- src/vlib/threads.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 49b6e811240..7454d5a18f3 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -1060,11 +1060,7 @@ vlib_worker_thread_node_refork (void) clib_mem_alloc_no_fail (vec_len (nm->nodes) * sizeof (*new_n_clone)); for (j = 0; j < vec_len (nm->nodes); j++) { - vlib_node_t *old_n_clone; - vlib_node_t *new_n; - - new_n = nm->nodes[j]; - old_n_clone = old_nodes_clone[j]; + vlib_node_t *new_n = nm->nodes[j]; clib_memcpy_fast (new_n_clone, new_n, sizeof (*new_n)); /* none of the copied nodes have enqueue rights given out */ @@ -1080,6 +1076,7 @@ vlib_worker_thread_node_refork (void) } else { + vlib_node_t *old_n_clone = old_nodes_clone[j]; /* Copy stats if the old data is valid */ clib_memcpy_fast (&new_n_clone->stats_total, &old_n_clone->stats_total, -- 2.16.6