Skip to content

Commit 8324c55

Browse files
Dave Barachflorincoras
authored andcommitted
ping: fix buffer allocator error handling
The code sets f->n_vectors = n_to_send, but it can bail out of the loop if vlib_buffer_copy(...) returns 0. Need to fix f->n_vectors in the error return path, or we enqueue some number of 0xfefefefe buffer indices in a debug image or worse in a production image. Type: fix Signed-off-by: Dave Barach <[email protected]> Change-Id: I2d886266006c6c1c2f9ef8e3b95eb46ac6c0b3df
1 parent 954c707 commit 8324c55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/plugins/ping/ping.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,8 @@ ip46_enqueue_packet (vlib_main_t * vm, vlib_buffer_t * b0, u32 burst,
933933
* we did not enqueue it here yet.
934934
*/
935935
ship_and_ret:
936+
ASSERT (n_to_send <= f->n_vectors);
937+
f->n_vectors -= n_to_send;
936938
n_sent += f->n_vectors;
937939
vlib_put_frame_to_node (vm, lookup_node_index, f);
938940
return n_sent;

0 commit comments

Comments
 (0)