svn commit: r213257 - head/lib/libthr/thread

David Xu davidxu at FreeBSD.org
Wed Sep 29 06:06:59 UTC 2010


Author: davidxu
Date: Wed Sep 29 06:06:58 2010
New Revision: 213257
URL: http://svn.freebsd.org/changeset/base/213257

Log:
  Check invalid mutex in _mutex_cv_unlock.

Modified:
  head/lib/libthr/thread/thr_mutex.c

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Wed Sep 29 02:36:58 2010	(r213256)
+++ head/lib/libthr/thread/thr_mutex.c	Wed Sep 29 06:06:58 2010	(r213257)
@@ -636,6 +636,12 @@ _mutex_cv_unlock(pthread_mutex_t *mutex,
 	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.
 	 */


More information about the svn-src-head mailing list