]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy: Fix icomplete initialization of BalancerMember(s) from the manager.
authorYann Ylavic <ylavic@apache.org>
Mon, 12 Jul 2021 10:32:21 +0000 (10:32 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 12 Jul 2021 10:32:21 +0000 (10:32 +0000)
Clear the workers created in ap_proxy_sync_balancer(), notably ->local_status
for below ap_proxy_initialize_worker() to initialize all the child structures
like ->cp and ->cp->reslist, avoiding a possible crash when the workers are
used at runtime.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891477 13f79535-47bb-0310-9956-ffa450edef68

changes-entries/ap_proxy_sync_balancer.txt [new file with mode: 0644]
modules/proxy/proxy_util.c

diff --git a/changes-entries/ap_proxy_sync_balancer.txt b/changes-entries/ap_proxy_sync_balancer.txt
new file mode 100644 (file)
index 0000000..208a29f
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_proxy: Fix icomplete initialization of BalancerMember(s) from the
+     balancer-manager, which can lead to a crash.  [Yann Ylavic]
index 3633a0ac658022259d50bdf911dce2a42e48edcd..f6bab191fe5e484d0a6c9dcf61a8619a5002300b 100644 (file)
@@ -3681,9 +3681,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec
             runtime = apr_array_push(b->workers);
             *runtime = apr_palloc(conf->pool, sizeof(proxy_worker));
             apr_global_mutex_unlock(proxy_mutex);
+            memset(*runtime, 0, sizeof(proxy_worker));
             (*runtime)->hash = shm->hash;
-            (*runtime)->context = NULL;
-            (*runtime)->cp = NULL;
             (*runtime)->balancer = b;
             (*runtime)->s = shm;
 #if APR_HAS_THREADS