git: 5b741298b11c - main - tcp rack: fix switching to RACK when FIN has been sent

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 19 Jul 2022 19:23:30 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=5b741298b11cdaec71877fa24b72764d1e697a33

commit 5b741298b11cdaec71877fa24b72764d1e697a33
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-07-19 18:28:25 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-07-19 18:28:25 +0000

    tcp rack: fix switching to RACK when FIN has been sent
    
    Fix the rack sendmap entry in case a FIN has been sent when the
    stack is switched over to RACK.
    
    Reported by:            syzbot+dd55e316428419e9354b@syzkaller.appspotmail.com
    Reviewed by:            rrs
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D35731
---
 sys/netinet/tcp_stacks/rack.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index ff43fbd02de2..ce33f507bc1c 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -12608,12 +12608,9 @@ rack_init(struct tcpcb *tp)
 		rsm->r_tim_lastsent[0] = rack_to_usec_ts(&rack->r_ctl.act_rcv_time);
 		rsm->r_rtr_cnt = 1;
 		rsm->r_rtr_bytes = 0;
-		if (tp->t_flags & TF_SENTFIN) {
-			rsm->r_end = tp->snd_max - 1;
+		if (tp->t_flags & TF_SENTFIN)
 			rsm->r_flags |= RACK_HAS_FIN;
-		} else {
-			rsm->r_end = tp->snd_max;
-		}
+		rsm->r_end = tp->snd_max;
 		if (tp->snd_una == tp->iss) {
 			/* The data space is one beyond snd_una */
 			rsm->r_flags |= RACK_HAS_SYN;