git: 36d33812f387 - stable/13 - tcp rack: fix switching to RACK when FIN has been sent

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 01 Feb 2023 23:30:41 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=36d33812f387f1dbc3b9e7b15fd94004bb81fb4e

commit 36d33812f387f1dbc3b9e7b15fd94004bb81fb4e
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-07-19 18:28:25 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-02-01 23:30:03 +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
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D35731
    
    (cherry picked from commit 5b741298b11cdaec71877fa24b72764d1e697a33)
---
 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 1cf89388399c..e11351e5c515 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -12283,12 +12283,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;