Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Dec 2021 18:43:09 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 37a7f5573716 - main - tcp_usr_rcvd: don't cast inp_ppcb to tcpcb before checking inp_flags
Message-ID:  <202112271843.1BRIh9Jt097762@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

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

commit 37a7f55737164e05d4bc4fa1f6510b4e624b6c45
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-12-27 18:41:51 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-12-27 18:41:51 +0000

    tcp_usr_rcvd: don't cast inp_ppcb to tcpcb before checking inp_flags
    
    Fixes:  f64dc2ab5be38e5366271ef85ea90d8cb1c7841a
---
 sys/netinet/tcp_usrreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 06dee4c90ed6..7c791e0c4871 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -934,12 +934,12 @@ tcp_usr_rcvd(struct socket *so, int flags)
 	inp = sotoinpcb(so);
 	KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
 	INP_WLOCK(inp);
-	NET_EPOCH_ENTER(et);
-	tp = intotcpcb(inp);
 	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
-		error = ECONNRESET;
-		goto out;
+		INP_WUNLOCK(inp);
+		return (ECONNRESET);
 	}
+	tp = intotcpcb(inp);
+	NET_EPOCH_ENTER(et);
 	TCPDEBUG1();
 	/*
 	 * For passively-created TFO connections, don't attempt a window



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112271843.1BRIh9Jt097762>