git: 205157fafc25 - stable/14 - tcp: fix sending RST after second inp lookup

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sat, 03 Aug 2024 22:35:09 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=205157fafc25f6711ef3670255f9ea328c344758

commit 205157fafc25f6711ef3670255f9ea328c344758
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-05-25 17:46:33 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-08-03 22:34:38 +0000

    tcp: fix sending RST after second inp lookup
    
    When we first find an inp, we set also the tp. If then a second
    lookup is necessary, the inp is recomputed. If this fails, the
    tp is not cleared, which resulted in failing KASSERT.
    Therefore, clear the tp when staring the inp lookup procedure.
    
    Reported by:    Jenkins
    Fixes:          02d15215cef2 ("tcp: improve blackhole support")
    Sponsored by:   Netflix, Inc.
    
    (cherry picked from commit df9de82f54d13aa077889349e15d9bf7794a1e6f)
---
 sys/netinet/tcp_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index a45eb3201f7e..133818b73a1d 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -829,6 +829,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
 	    ((thflags & (TH_ACK|TH_SYN)) == TH_SYN ?
 	    INPLOOKUP_RLOCKPCB : INPLOOKUP_WLOCKPCB);
 findpcb:
+	tp = NULL;
 #ifdef INET6
 	if (isipv6 && fwd_tag != NULL) {
 		struct sockaddr_in6 *next_hop6;