summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-08-19 01:45:16 +0000
committerrwatson <rwatson@FreeBSD.org>2004-08-19 01:45:16 +0000
commit3d9f38d578f2750c746f9dd136227ca23b607aa8 (patch)
treeb62b11d47c519b8b5537dd0a4a250375cac2dbd7
parenteb3ee278bcf97fff45e19e3ad7f70bc3a318208a (diff)
downloadFreeBSD-src-3d9f38d578f2750c746f9dd136227ca23b607aa8.zip
FreeBSD-src-3d9f38d578f2750c746f9dd136227ca23b607aa8.tar.gz
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.
-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 4075f8a..9f41320 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;
OpenPOWER on IntegriCloud