mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
Fix an off-by-one error in the recursive mutex handling that made it
prematurely release recursive mutexes. Test case provided by: Bradley T. Hughes <bhughes@trolltech.com> Reviewed by: deischen
This commit is contained in:
parent
74e6090127
commit
022daa34f2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64574
@ -753,7 +753,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -821,7 +821,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -939,7 +939,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
|
@ -753,7 +753,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -821,7 +821,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -939,7 +939,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
|
@ -753,7 +753,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -821,7 +821,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
@ -939,7 +939,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference)
|
||||
ret = (*mutex)->m_owner == NULL ? EINVAL : EPERM;
|
||||
}
|
||||
else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
|
||||
((*mutex)->m_data.m_count > 1)) {
|
||||
((*mutex)->m_data.m_count > 0)) {
|
||||
/* Decrement the count: */
|
||||
(*mutex)->m_data.m_count--;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user