aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-04-22 19:15:49 +0200
committerFlorin Coras <florin.coras@gmail.com>2020-04-22 18:42:39 +0000
commita04adbf5368f9ec907508ff36d42fbd72d287120 (patch)
tree3766c65acc7191d79321510323f29d69125f224a /src/vnet/tcp
parent6e0ee95df5d2e216ce7824eeb1fbb79656d73368 (diff)
tcp: fix use-after-free
bts can be freed by the call to bt_fix_overlapped(). Save flags for later use. Type: fix Change-Id: If8b48c96ce39e38f2ed7f4db2815122523eb2e05 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp_bt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp_bt.c b/src/vnet/tcp/tcp_bt.c
index 6f9ee0168f7..eaec147b836 100644
--- a/src/vnet/tcp/tcp_bt.c
+++ b/src/vnet/tcp/tcp_bt.c
@@ -366,13 +366,17 @@ tcp_bt_track_rxt (tcp_connection_t * tc, u32 start, u32 end)
/* Head overlap */
if (bts->min_seq == start)
{
+ /* bts can be freed by bt_fix_overlapped() below */
+ tcp_bts_flags_t bts_flags = bts->flags;
+
prev_index = bts->prev;
next = bt_fix_overlapped (bt, bts, end, is_end);
+ /* bts is no longer valid from here */
next_index = bt_sample_index (bt, next);
cur = tcp_bt_alloc_tx_sample (tc, start, end);
cur->flags |= TCP_BTS_IS_RXT;
- if (bts->flags & TCP_BTS_IS_RXT)
+ if (bts_flags & TCP_BTS_IS_RXT)
cur->flags |= TCP_BTS_IS_RXT_LOST;
cur->next = next_index;
cur->prev = prev_index;