git: 1b72d275eef4 - stable/14 - tcp: unlock before syncookie_expand()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Sep 2025 18:07:37 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=1b72d275eef4b3219708bbe9ef5a898c967195dd
commit 1b72d275eef4b3219708bbe9ef5a898c967195dd
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-06-17 15:50:23 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-09-09 18:07:18 +0000
tcp: unlock before syncookie_expand()
The function doesn't need a lock on sch. It uses the pointer as value for
the SipHash calculation.
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D50898
(cherry picked from commit 0809d26de24defdc4a2ae161357566c02dc163d1)
---
sys/netinet/tcp_syncache.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index b50d6e9ea84e..4adb92fff36c 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1122,14 +1122,13 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
s, __func__);
goto failed;
}
+ if (locked)
+ SCH_UNLOCK(sch);
bzero(&scs, sizeof(scs));
if (syncookie_expand(inc, sch, &scs, th, to, *lsop, port)) {
sc = &scs;
TCPSTAT_INC(tcps_sc_recvcookie);
- }
- if (locked)
- SCH_UNLOCK(sch);
- if (sc == NULL) {
+ } else {
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Segment failed "
"SYNCOOKIE authentication, segment rejected "