Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2010 06:06:59 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213257 - head/lib/libthr/thread
Message-ID:  <201009290606.o8T66xja098067@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009290606.o8T66xja098067>