From c22fcba177bad2c755fdb6d4d52f2a799eceaf34 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 6 Mar 2018 18:46:54 +0100 Subject: vlib: avoid crash if fill_free_list returns 0 buffers Change-Id: If1284696e10df71b4029191b5e3adb32c21c0c5f Signed-off-by: Damjan Marion --- src/vlib/buffer_funcs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h index 6ea804f8ec4..d1aecac7e80 100644 --- a/src/vlib/buffer_funcs.h +++ b/src/vlib/buffer_funcs.h @@ -304,7 +304,8 @@ vlib_buffer_alloc_from_free_list (vlib_main_t * vm, if (PREDICT_FALSE (len < n_buffers)) { bm->cb.vlib_buffer_fill_free_list_cb (vm, fl, n_buffers); - len = vec_len (fl->buffers); + if (PREDICT_FALSE ((len = vec_len (fl->buffers)) == 0)) + return 0; /* even if fill free list didn't manage to refill free list we should give what we have */ -- cgit 1.2.3-korg