Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163611100
D26301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26301.diff
View Options
Index: sys/kern/uipc_usrreq.c
===================================================================
--- sys/kern/uipc_usrreq.c
+++ sys/kern/uipc_usrreq.c
@@ -1013,11 +1013,6 @@
const struct sockaddr *from;
if (nam != NULL) {
- /* XXX racy. */
- if (unp->unp_conn != NULL) {
- error = EISCONN;
- break;
- }
error = unp_connect(so, nam, td);
if (error != 0)
break;
@@ -1069,11 +1064,6 @@
case SOCK_STREAM:
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
- /* XXX racy. */
- if (unp->unp_conn != NULL) {
- error = EISCONN;
- break;
- }
error = unp_connect(so, nam, td);
if (error != 0)
break;
@@ -1508,7 +1498,11 @@
unp = sotounpcb(so);
UNP_PCB_LOCK(unp);
- if (unp->unp_flags & UNP_CONNECTING) {
+ if (unp->unp_conn != NULL) {
+ UNP_PCB_UNLOCK(unp);
+ return (EISCONN);
+ }
+ if ((unp->unp_flags & UNP_CONNECTING) != 0) {
UNP_PCB_UNLOCK(unp);
return (EALREADY);
}
@@ -1652,6 +1646,8 @@
UNP_PCB_LOCK_ASSERT(unp);
UNP_PCB_LOCK_ASSERT(unp2);
+ KASSERT(unp->unp_conn == NULL,
+ ("%s: socket %p is already connected", __func__, unp));
if (so2->so_type != so->so_type)
return (EPROTOTYPE);
@@ -1668,6 +1664,8 @@
case SOCK_STREAM:
case SOCK_SEQPACKET:
+ KASSERT(unp2->unp_conn == NULL,
+ ("%s: socket %p is already connected", __func__, unp2));
unp2->unp_conn = unp;
if (req == PRU_CONNECT &&
((unp->unp_flags | unp2->unp_flags) & UNP_CONNWAIT))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 25, 9:12 PM (15 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35482589
Default Alt Text
D26301.diff (1 KB)
Attached To
Mode
D26301: [unix(4) cleanup 8/8] Fix a double connect race.
Attached
Detach File
Event Timeline
Log In to Comment