Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151675695
D55968.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D55968.diff
View Options
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1417,13 +1417,14 @@
{
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)) {
/* See the comment in in_pcbinshash(). */
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1534,16 +1534,12 @@
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);
@@ -1644,16 +1640,12 @@
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);
@@ -1716,9 +1708,7 @@
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);
@@ -1726,9 +1716,7 @@
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);
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -507,13 +507,14 @@
{
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)) {
/* See the comment in in_pcbinshash(). */
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -989,9 +989,7 @@
udp6_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, ("udp6_abort: inp == NULL"));
@@ -1005,9 +1003,7 @@
#endif
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
- INP_HASH_WLOCK(pcbinfo);
in6_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
soisdisconnected(so);
}
INP_WUNLOCK(inp);
@@ -1107,9 +1103,7 @@
udp6_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, ("udp6_close: inp == NULL"));
@@ -1122,9 +1116,7 @@
}
#endif
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
- INP_HASH_WLOCK(pcbinfo);
in6_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
soisdisconnected(so);
}
INP_WUNLOCK(inp);
@@ -1246,9 +1238,7 @@
udp6_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, ("udp6_disconnect: inp == NULL"));
@@ -1266,9 +1256,7 @@
return (ENOTCONN);
}
- INP_HASH_WLOCK(pcbinfo);
in6_pcbdisconnect(inp);
- INP_HASH_WUNLOCK(pcbinfo);
SOCK_LOCK(so);
so->so_state &= ~SS_ISCONNECTED; /* XXX */
SOCK_UNLOCK(so);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 10:56 PM (8 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31251650
Default Alt Text
D55968.diff (4 KB)
Attached To
Mode
D55968: inpcb: make in_pcbdisconnect() acquire the hash lock internally
Attached
Detach File
Event Timeline
Log In to Comment