Page MenuHomeFreeBSD

D26301.diff
No OneTemporary

D26301.diff

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

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)

Event Timeline