Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107170873
D7398.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7398.diff
View Options
Index: head/sys/kern/uipc_usrreq.c
===================================================================
--- head/sys/kern/uipc_usrreq.c
+++ head/sys/kern/uipc_usrreq.c
@@ -430,6 +430,8 @@
unp->unp_socket = so;
so->so_pcb = unp;
unp->unp_refcount = 1;
+ if (so->so_head != NULL)
+ unp->unp_flags |= UNP_NASCENT;
UNP_LIST_LOCK();
unp->unp_gencnt = ++unp_gencnt;
@@ -652,14 +654,22 @@
unp = sotounpcb(so);
KASSERT(unp != NULL, ("uipc_detach: unp == NULL"));
- UNP_LINK_WLOCK();
+ vp = NULL;
+ local_unp_rights = 0;
+
UNP_LIST_LOCK();
- UNP_PCB_LOCK(unp);
LIST_REMOVE(unp, unp_link);
unp->unp_gencnt = ++unp_gencnt;
--unp_count;
UNP_LIST_UNLOCK();
+ if ((unp->unp_flags & UNP_NASCENT) != 0) {
+ UNP_PCB_LOCK(unp);
+ goto teardown;
+ }
+ UNP_LINK_WLOCK();
+ UNP_PCB_LOCK(unp);
+
/*
* XXXRW: Should assert vp->v_socket == so.
*/
@@ -687,6 +697,7 @@
}
local_unp_rights = unp_rights;
UNP_LINK_WUNLOCK();
+teardown:
unp->unp_socket->so_pcb = NULL;
saved_unp_addr = unp->unp_addr;
unp->unp_addr = NULL;
@@ -1473,6 +1484,7 @@
if (so2->so_type != so->so_type)
return (EPROTOTYPE);
+ unp2->unp_flags &= ~UNP_NASCENT;
unp->unp_conn = unp2;
switch (so->so_type) {
Index: head/sys/sys/unpcb.h
===================================================================
--- head/sys/sys/unpcb.h
+++ head/sys/sys/unpcb.h
@@ -103,11 +103,6 @@
#define UNP_WANTCRED 0x004 /* credentials wanted */
#define UNP_CONNWAIT 0x008 /* connect blocks until accepted */
-#define UNPGC_REF 0x1 /* unpcb has external ref. */
-#define UNPGC_DEAD 0x2 /* unpcb might be dead. */
-#define UNPGC_SCANNED 0x4 /* Has been scanned. */
-#define UNPGC_IGNORE_RIGHTS 0x8 /* Attached rights are freed */
-
/*
* These flags are used to handle non-atomicity in connect() and bind()
* operations on a socket: in particular, to avoid races between multiple
@@ -115,6 +110,15 @@
*/
#define UNP_CONNECTING 0x010 /* Currently connecting. */
#define UNP_BINDING 0x020 /* Currently binding. */
+#define UNP_NASCENT 0x040 /* Newborn child socket. */
+
+/*
+ * Flags in unp_gcflag.
+ */
+#define UNPGC_REF 0x1 /* unpcb has external ref. */
+#define UNPGC_DEAD 0x2 /* unpcb might be dead. */
+#define UNPGC_SCANNED 0x4 /* Has been scanned. */
+#define UNPGC_IGNORE_RIGHTS 0x8 /* Attached rights are freed */
#define sotounpcb(so) ((struct unpcb *)((so)->so_pcb))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 5:03 AM (18 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15761521
Default Alt Text
D7398.diff (2 KB)
Attached To
Mode
D7398: Recursive lock panic of UNP_LINK_WLOCK
Attached
Detach File
Event Timeline
Log In to Comment