Skip to content

Commit

Permalink
ping: fix buffer allocator error handling
Browse files Browse the repository at this point in the history
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 <dave@barachs.net>
Change-Id: I2d886266006c6c1c2f9ef8e3b95eb46ac6c0b3df
  • Loading branch information
Dave Barach authored and florincoras committed Apr 8, 2020
1 parent 954c707 commit 8324c55
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ ip46_enqueue_packet (vlib_main_t * vm, vlib_buffer_t * b0, u32 burst,
* we did not enqueue it here yet.
*/
ship_and_ret:
ASSERT (n_to_send <= f->n_vectors);
f->n_vectors -= n_to_send;
n_sent += f->n_vectors;
vlib_put_frame_to_node (vm, lookup_node_index, f);
return n_sent;
Expand Down

0 comments on commit 8324c55

Please sign in to comment.