aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_usrreq.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-08-19 01:45:16 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-08-19 01:45:16 +0000
commit4c5bc1ca39ba3492924f9f2f7439854d49b10df3 (patch)
treeb62b11d47c519b8b5537dd0a4a250375cac2dbd7 /sys/kern/uipc_usrreq.c
parent5c32ea6517b3ac795fc6a10fa3b24dd48f11517a (diff)
downloadsrc-4c5bc1ca39ba3492924f9f2f7439854d49b10df3.tar.gz
src-4c5bc1ca39ba3492924f9f2f7439854d49b10df3.zip
Add UNP_UNLOCK_ASSERT() to asser that the UNIX domain socket subsystem
lock is not held. Rather than annotating that the lock is released after calls to unp_detach() with a comment, annotate with an assertion. Assert that the UNIX domain socket subsystem lock is not held when unp_externalize() and unp_internalize() are called.
Notes
Notes: svn path=/head/; revision=133995
Diffstat (limited to 'sys/kern/uipc_usrreq.c')
-rw-r--r--sys/kern/uipc_usrreq.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 4075f8aacfd1..9f41320773e9 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -108,6 +108,7 @@ static struct mtx unp_mtx;
#define UNP_LOCK() mtx_lock(&unp_mtx)
#define UNP_UNLOCK() mtx_unlock(&unp_mtx)
#define UNP_LOCK_ASSERT() mtx_assert(&unp_mtx, MA_OWNED)
+#define UNP_UNLOCK_ASSERT() mtx_assert(&unp_mtx, MA_NOTOWNED)
static int unp_attach(struct socket *);
static void unp_detach(struct unpcb *);
@@ -137,7 +138,8 @@ uipc_abort(struct socket *so)
return (EINVAL);
}
unp_drop(unp, ECONNABORTED);
- unp_detach(unp); /* NB: unlocks */
+ unp_detach(unp);
+ UNP_UNLOCK_ASSERT();
SOCK_LOCK(so);
sotryfree(so);
return (0);
@@ -248,7 +250,8 @@ uipc_detach(struct socket *so)
UNP_UNLOCK();
return (EINVAL);
}
- unp_detach(unp); /* NB: unlocks unp */
+ unp_detach(unp);
+ UNP_UNLOCK_ASSERT();
return (0);
}
@@ -1041,6 +1044,7 @@ unp_abort(unp)
{
unp_detach(unp);
+ UNP_UNLOCK_ASSERT();
}
#endif
@@ -1232,6 +1236,8 @@ unp_externalize(control, controlp)
int f;
u_int newlen;
+ UNP_UNLOCK_ASSERT();
+
error = 0;
if (controlp != NULL) /* controlp == NULL => free control messages */
*controlp = NULL;
@@ -1358,6 +1364,8 @@ unp_internalize(controlp, td)
int error, oldfds;
u_int newlen;
+ UNP_UNLOCK_ASSERT();
+
error = 0;
*controlp = NULL;