aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-03-06 18:46:54 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-06 20:02:21 +0000
commitc22fcba177bad2c755fdb6d4d52f2a799eceaf34 (patch)
tree352fd02a797c7838bbacc2ded5e9a5305dad03d3 /src/vlib
parent1275651d77f8e34169654385d7769a83842e2505 (diff)
vlib: avoid crash if fill_free_list returns 0 buffers
Change-Id: If1284696e10df71b4029191b5e3adb32c21c0c5f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer_funcs.h3
1 files changed, 2 insertions, 1 deletions
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 */