diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2006-03-18 01:22:36 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2006-03-18 01:22:36 +0000 |
commit | fab120e7d04ebc054c46ae5e66d30c8591744557 (patch) | |
tree | 980939ec17fc9f696f50cac53b530171cee406c5 /locks | |
parent | 43d9afa6d118b32d1b409e3a7e2ac3176df824a6 (diff) | |
download | apr-fab120e7d04ebc054c46ae5e66d30c8591744557.tar.gz |
Close a kernel layer segfault when the user attempts to lock
a critical section after DeleteCriticalSection() has been
invoked. There is no protection in the lock/unlock kernel
code, so ensure we don't enter the critical section path at
all with deleted mutex, and fail instead by attempting to
wait on a bad handle, resulting in a less drastic failure.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@386780 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/win32/thread_mutex.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/locks/win32/thread_mutex.c b/locks/win32/thread_mutex.c index 0a848fbcf..20c757f96 100644 --- a/locks/win32/thread_mutex.c +++ b/locks/win32/thread_mutex.c @@ -28,6 +28,7 @@ static apr_status_t thread_mutex_cleanup(void *data) apr_thread_mutex_t *lock = data; if (lock->type == thread_mutex_critical_section) { + lock->type = -1; DeleteCriticalSection(&lock->section); } else { @@ -60,8 +61,8 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, * use a [slower] mutex object, instead. */ IF_WIN_OS_IS_UNICODE { - (*mutex)->type = thread_mutex_critical_section; InitializeCriticalSection(&(*mutex)->section); + (*mutex)->type = thread_mutex_critical_section; } #endif #if APR_HAS_ANSI_FS |