From: Jeff Trawick Date: Sun, 19 Aug 2012 22:38:57 +0000 (+0000) Subject: WinNT MPM: Fix thread-safety issue in worker_main(). All X-Git-Tag: 2.5.0-alpha~6408 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c02f9309b6269f5d97766557ebb740a6fe287c18;p=thirdparty%2Fapache%2Fhttpd.git WinNT MPM: Fix thread-safety issue in worker_main(). All workers were allocating from pchild without holding ' child_lock. Allocate from ptrans instead. Related to: PR 52196 The reporter suggests that the apr_thread_t for r->connection->current_thread should have a unique pool. This revision handles that for WinNT MPM, but not for other MPMs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1374874 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index b2ca691fbae..da9f0a09c11 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -798,7 +798,7 @@ apr_status_t winnt_insert_network_bucket(conn_rec *c, */ static DWORD __stdcall worker_main(void *thread_num_val) { - apr_thread_t *thd = NULL; + apr_thread_t *thd; apr_os_thread_t osthd; static int requests_this_child = 0; winnt_conn_ctx_t *context = NULL; @@ -810,7 +810,6 @@ static DWORD __stdcall worker_main(void *thread_num_val) apr_int32_t disconnected; osthd = apr_os_thread_current(); - apr_os_thread_put(&thd, &osthd, pchild); while (1) { @@ -848,6 +847,8 @@ static DWORD __stdcall worker_main(void *thread_num_val) continue; } + thd = NULL; + apr_os_thread_put(&thd, &osthd, context->ptrans); c->current_thread = thd; /* follow ap_process_connection(c, context->sock) logic