diff options
author | Christopher Ferris <cferris@google.com> | 2015-06-09 18:46:15 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2015-06-09 18:46:15 -0700 |
commit | 511cfd9dc8cb41bca4920687c7d816ee916ee8e5 (patch) | |
tree | 802f0fa957f99a38068981600a7fc81f68f04950 /libc/bionic | |
parent | 26e663d4796e74fc40a62b3d2a438b726bbb056e (diff) | |
download | bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.zip bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.tar.gz bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.tar.bz2 |
Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to
fail silently on L 32 bit devices when passed a NULL. We changed
this to a crash on 32 bit devices, but there are still games that make
these calls and are not likely to be updated. Therefore, once again
allow NULL to be passed in on 32 bit devices.
Bug: 19995172
Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/pthread_mutex.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp index 4fec753..851fc3d 100644 --- a/libc/bionic/pthread_mutex.cpp +++ b/libc/bionic/pthread_mutex.cpp @@ -501,6 +501,12 @@ static int __pthread_mutex_lock_with_timeout(pthread_mutex_internal_t* mutex, } int pthread_mutex_lock(pthread_mutex_t* mutex_interface) { +#if !defined(__LP64__) + if (mutex_interface == NULL) { + return EINVAL; + } +#endif + pthread_mutex_internal_t* mutex = __get_internal_mutex(mutex_interface); uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed); @@ -516,6 +522,12 @@ int pthread_mutex_lock(pthread_mutex_t* mutex_interface) { } int pthread_mutex_unlock(pthread_mutex_t* mutex_interface) { +#if !defined(__LP64__) + if (mutex_interface == NULL) { + return EINVAL; + } +#endif + pthread_mutex_internal_t* mutex = __get_internal_mutex(mutex_interface); uint16_t old_state = atomic_load_explicit(&mutex->state, memory_order_relaxed); |