From: Stefan Eissing Date: Tue, 10 Aug 2021 08:32:35 +0000 (+0000) Subject: *) mod_proxy: Fix icomplete initialization of BalancerMember(s) from the X-Git-Tag: candidate-2.4.49~3^2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04c7b15eecbc889a6a3c8060709ebd020d0a571;p=thirdparty%2Fapache%2Fhttpd.git *) mod_proxy: Fix icomplete initialization of BalancerMember(s) from the balancer-manager, which can lead to a crash. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892165 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 1322a4a8a45..9aa3971189e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.49 + *) mod_proxy: Fix icomplete initialization of BalancerMember(s) from the + balancer-manager, which can lead to a crash. [Yann Ylavic] + *) mpm_event: Fix graceful stop/restart of children processes if connections are in lingering close for too long. [Yann Ylavic] diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 9ad5b56f228..a87501ed6c5 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -3608,18 +3608,15 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec } if (!found) { proxy_worker **runtime; + /* XXX: a thread mutex is maybe enough here */ apr_global_mutex_lock(proxy_mutex); runtime = apr_array_push(b->workers); - *runtime = apr_palloc(conf->pool, sizeof(proxy_worker)); + *runtime = apr_pcalloc(conf->pool, sizeof(proxy_worker)); apr_global_mutex_unlock(proxy_mutex); (*runtime)->hash = shm->hash; - (*runtime)->context = NULL; - (*runtime)->cp = NULL; (*runtime)->balancer = b; (*runtime)->s = shm; -#if APR_HAS_THREADS - (*runtime)->tmutex = NULL; -#endif + rv = ap_proxy_initialize_worker(*runtime, s, conf->pool); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(00966) "Cannot init worker");