Check invalid mutex in _mutex_cv_unlock.

This commit is contained in:
David Xu 2010-09-29 06:06:58 +00:00
parent 8d2a935e45
commit ec92603cf9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213257

View File

@ -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.
*/