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.
         */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to