aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-04-12 18:32:06 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-04-12 18:32:06 +0000
commit0ba87ded9d072b7b0605d2f4e8a7232b33b8787e (patch)
tree6896013258672ff5159f8fc6d7aace395aa46e43 /sys/netinet
parentac5b9628002c7c97929984eb578918077d564be4 (diff)
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c3
-rw-r--r--sys/netinet/udp_usrreq.c12
2 files changed, 2 insertions, 13 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index cb5b7fa274f6..8bc90de239c2 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1423,13 +1423,14 @@ in_pcbdisconnect(struct inpcb *inp)
{
INP_WLOCK_ASSERT(inp);
- INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo);
KASSERT(inp->inp_smr == SMR_SEQ_INVALID,
("%s: inp %p was already disconnected", __func__, inp));
+ INP_HASH_WLOCK(inp->inp_pcbinfo);
in_pcbremhash(inp);
CK_LIST_INSERT_HEAD(&inp->inp_pcbinfo->ipi_list_unconn, inp,
inp_unconn_list);
+ INP_HASH_WUNLOCK(inp->inp_pcbinfo);
if ((inp->inp_socket->so_proto->pr_flags & PR_CONNREQUIRED) == 0) {
/* See the comment in in_pcbinshash(). */
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index eb37ceddace0..e425af92048d 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1528,16 +1528,12 @@ void
udp_abort(struct socket *so)
{
struct inpcb *inp;
- struct inpcbinfo *pcbinfo;
- pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_abort: inp == NULL"));
INP_WLOCK(inp);
if (inp->inp_faddr.s_addr != INADDR_ANY) {
- INP_HASH_WLOCK(pcbinfo);
in_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
soisdisconnected(so);
}
INP_WUNLOCK(inp);
@@ -1638,16 +1634,12 @@ static void
udp_close(struct socket *so)
{
struct inpcb *inp;
- struct inpcbinfo *pcbinfo;
- pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_close: inp == NULL"));
INP_WLOCK(inp);
if (inp->inp_faddr.s_addr != INADDR_ANY) {
- INP_HASH_WLOCK(pcbinfo);
in_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
soisdisconnected(so);
}
INP_WUNLOCK(inp);
@@ -1710,9 +1702,7 @@ int
udp_disconnect(struct socket *so)
{
struct inpcb *inp;
- struct inpcbinfo *pcbinfo;
- pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_disconnect: inp == NULL"));
INP_WLOCK(inp);
@@ -1720,9 +1710,7 @@ udp_disconnect(struct socket *so)
INP_WUNLOCK(inp);
return (ENOTCONN);
}
- INP_HASH_WLOCK(pcbinfo);
in_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
SOCK_LOCK(so);
so->so_state &= ~SS_ISCONNECTED; /* XXX */
SOCK_UNLOCK(so);