aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_syncache.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2023-12-27 16:34:37 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2024-01-09 00:29:38 +0000
commit2bfe735277b8858dd7ad937e0bf2286bdfb45182 (patch)
treef9f4c5ef9a0bba09d96a933621041657d90db486 /sys/netinet/tcp_syncache.c
parent7cfc847aba1356c34ea12d73f6ac72793056fcde (diff)
inpcb: reoder inpcb destruction
First, merge in_pcbdetach() with in_pcbfree(). The comment for in_pcbdetach() was no longer correct. Then, make sure we remove the inpcb from the hash before we commit any destructive actions on it. There are couple functions that rely on the hash lock skipping SMR + inpcb lock to lookup an inpcb. Although there are no known functions that similarly rely on the global inpcb list lock, also do list removal before destructive actions. PR: 273890 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D43122 (cherry picked from commit a13039e2709277b1c3b159e694cc909a5e044151)
Diffstat (limited to 'sys/netinet/tcp_syncache.c')
-rw-r--r--sys/netinet/tcp_syncache.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 2c381ef600d6..20c77930556e 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -803,7 +803,6 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
}
inp = sotoinpcb(so);
if ((tp = tcp_newtcpcb(inp)) == NULL) {
- in_pcbdetach(inp);
in_pcbfree(inp);
sodealloc(so);
goto allocfail;
@@ -1051,7 +1050,6 @@ allocfail:
return (NULL);
abort:
- in_pcbdetach(inp);
in_pcbfree(inp);
sodealloc(so);
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {