about summary refs log tree commit diff
path: root/linuxthreads/mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/mutex.c')
-rw-r--r--linuxthreads/mutex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index 9ce4a30820..9b4a3c7f56 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -163,6 +163,8 @@ int __pthread_mutex_unlock(pthread_mutex_t * mutex)
     __pthread_unlock(&mutex->__m_lock);
     return 0;
   case PTHREAD_MUTEX_RECURSIVE_NP:
+    if (mutex->__m_owner != thread_self())
+      return EPERM;
     if (mutex->__m_count > 0) {
       mutex->__m_count--;
       return 0;