aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2018-11-25 15:42:47 +0200
committerDave Barach <openvpp@barachs.net>2018-11-25 15:30:13 +0000
commitce55bcde5d3e4d69af4b9bcd3e8f4c31732a8603 (patch)
treed52e101d8ec25a770283456c4929419598012897 /src
parentc29a0ea6900672afe37a995fb2c18490074bb04a (diff)
vlib:init free list buffers vec
fixes a problem seen when dhcp proxy uses vlib_buffer_chain_linearize function which tries to vlib_buffer_alloc zero buffers - which succeeds if the buffers vector is initialized but otherwise crashes when trying to update the _vec_len in vlib_buffer_alloc_from_free_list solved by initializing the free_list buffers vec Change-Id: I1186d7aac05e54864d72f3f144e1bef8064f8efa Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/buffer.c4
-rw-r--r--src/vlib/threads.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 133d640d693..3c117c1523f 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -386,6 +386,8 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm,
clib_memset (f, 0, sizeof (f[0]));
f->index = f - vm->buffer_free_list_pool;
+ vec_validate (f->buffers, 0);
+ vec_reset_length (f->buffers);
f->n_data_bytes = vlib_buffer_round_size (n_data_bytes);
f->min_n_buffers_each_alloc = VLIB_FRAME_SIZE;
f->buffer_pool_index = 0;
@@ -412,6 +414,8 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm,
wf - wvm->buffer_free_list_pool);
wf[0] = f[0];
wf->buffers = 0;
+ vec_validate (wf->buffers, 0);
+ vec_reset_length (wf->buffers);
wf->n_alloc = 0;
}
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index fc2586c8967..3e184e3e1cd 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -882,6 +882,8 @@ start_workers (vlib_main_t * vm)
fl_clone[0] = fl_orig[0];
fl_clone->buffers = 0;
+ vec_validate(fl_clone->buffers, 0);
+ vec_reset_length(fl_clone->buffers);
fl_clone->n_alloc = 0;
}));
/* *INDENT-ON* */