session: fix use-after-free in input node 05/26605/3
authorBenoît Ganne <bganne@cisco.com>
Fri, 17 Apr 2020 10:09:37 +0000 (12:09 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Mon, 20 Apr 2020 16:07:09 +0000 (16:07 +0000)
Type: fix

Change-Id: Ie60b07abe76ad166f048f5885accd7038d8153b2
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/vnet/session/session_node.c

index 0f5030b..8a96f58 100644 (file)
@@ -959,6 +959,8 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
       return SESSION_TX_NO_BUFFERS;
     }
 
+  transport_connection_update_tx_bytes (ctx->tc, ctx->max_len_to_snd);
+
   ctx->left_to_snd = ctx->max_len_to_snd;
   n_left = ctx->n_segs_per_evt;
 
@@ -1032,7 +1034,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
     vlib_buffer_free (vm, wrk->tx_buffers, n_bufs);
 
   *n_tx_packets += ctx->n_segs_per_evt;
-  transport_connection_update_tx_bytes (ctx->tc, ctx->max_len_to_snd);
 
   SESSION_EVT (SESSION_EVT_DEQ, ctx->s, ctx->max_len_to_snd, ctx->max_dequeue,
               ctx->s->tx_fifo->has_event, wrk->last_vlib_time);