summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-09-29 06:06:58 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-09-29 06:06:58 +0000
commitdf6acfd7c436d98725e8dab37393e51f4f394496 (patch)
tree5668b6c8a528faa678958c0193eea7a8c669021e /lib/libthr/thread
parent1ffab4f669c64f75d49675ad6283c168655d9f0b (diff)
downloadFreeBSD-src-df6acfd7c436d98725e8dab37393e51f4f394496.zip
FreeBSD-src-df6acfd7c436d98725e8dab37393e51f4f394496.tar.gz
Check invalid mutex in _mutex_cv_unlock.
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r--lib/libthr/thread/thr_mutex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 12ff1df..a83454a 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -636,6 +636,12 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, int *count)
struct pthread_mutex *m;
m = *mutex;
+ if (__predict_false(m <= THR_MUTEX_DESTROYED)) {
+ if (m == THR_MUTEX_DESTROYED)
+ return (EINVAL);
+ return (EPERM);
+ }
+
/*
* Check if the running thread is not the owner of the mutex.
*/
OpenPOWER on IntegriCloud