aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2022-09-19 10:42:43 +0000
committerRichard Scheffenegger <rscheff@FreeBSD.org>2022-09-25 08:41:54 +0000
commit26370413d43bfd65500270ff331ae6bdf0f54133 (patch)
treee01ef506df5dc2600a34812cc748b07726d3cb35
parent5c12f9352189886b11720ddb8774415292cff6fd (diff)
tcp: fix computation of offset
Only update the offset if actually retransmitting from the scoreboard. If not done correctly, this may result in trying to (re)-transmit data not being being in the socket buffe and therefore resulting in a panic. PR: 264257 PR: 263445 PR: 260393 Reviewed by: rscheff@ MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D36626 (cherry picked from commit 6d9e911fbadf3b409802a211c1dae9b47cb5a2b8)
-rw-r--r--sys/netinet/tcp_output.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index b486f6250508..e8d585a15d1c 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -317,10 +317,10 @@ again:
len = ((int32_t)ulmin(cwin,
SEQ_SUB(p->end, p->rxmit)));
}
- off = SEQ_SUB(p->rxmit, tp->snd_una);
- KASSERT(off >= 0,("%s: sack block to the left of una : %d",
- __func__, off));
if (len > 0) {
+ off = SEQ_SUB(p->rxmit, tp->snd_una);
+ KASSERT(off >= 0,("%s: sack block to the left of una : %d",
+ __func__, off));
sack_rxmit = 1;
sendalot = 1;
TCPSTAT_INC(tcps_sack_rexmits);