Page MenuHomeFreeBSD

D7398.id19020.diff
No OneTemporary

D7398.id19020.diff

Index: sys/kern/uipc_usrreq.c
===================================================================
--- sys/kern/uipc_usrreq.c
+++ sys/kern/uipc_usrreq.c
@@ -1382,10 +1382,23 @@
goto bad2;
}
if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
+
+ unp2 = sotounpcb(so2);
if (so2->so_options & SO_ACCEPTCONN) {
- CURVNET_SET(so2->so_vnet);
- so3 = sonewconn(so2, 0);
- CURVNET_RESTORE();
+
+ /* Ref count for unp2 of so2, before we drop the lock so that we
+ * dont loose unp2 from under in uipc_detach.
+ */
+ unp2->unp_refcount++;
+ UNP_LINK_WUNLOCK();
+ CURVNET_SET(so2->so_vnet);
+ so3 = sonewconn(so2, 0);
+ CURVNET_RESTORE();
+ UNP_LINK_WLOCK();
+ unp2->unp_refcount--;
+ /* make sure v_socket is stable as we dropped the lock earlier. */
+ VOP_UNP_CONNECT(vp, &so2);
+
} else
so3 = NULL;
if (so3 == NULL) {
@@ -1393,7 +1406,6 @@
goto bad2;
}
unp = sotounpcb(so);
- unp2 = sotounpcb(so2);
unp3 = sotounpcb(so3);
UNP_PCB_LOCK(unp);
UNP_PCB_LOCK(unp2);

File Metadata

Mime Type
text/plain
Expires
Thu, May 21, 6:28 PM (7 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33401877
Default Alt Text
D7398.id19020.diff (1 KB)

Event Timeline