git: df9de82f54d1 - main - tcp: fix sending RST after second inp lookup

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sat, 25 May 2024 17:58:56 UTC
The branch main has been updated by tuexen:

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

commit df9de82f54d13aa077889349e15d9bf7794a1e6f
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-05-25 17:46:33 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-05-25 17:58:48 +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")
    MFC after:      1 week
    Sponsored by:   Netflix, Inc.
---
 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 08ff84039c90..7faa815fc1ac 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -833,6 +833,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;