[PATCH] Upstream: fixed missing return in error handling

Maxim Dounin mdounin at mdounin.ru
Sat Jun 27 03:35:03 UTC 2026


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1782513352 -10800
#      Sat Jun 27 01:35:52 2026 +0300
# Node ID 3072e5ce18a55cae5d1389d1b396cc62c2e053ab
# Parent  7a3dbb7905ad5d4ad065a219148fecfed34894b7
Upstream: fixed missing return in error handling.

Missed in 9295:c5623963c29e (1.27.2), might cause segmentation faults on
memory allocation errors with proxy_no_cache (or if script buffer
overrun protections are triggered during evaluation of proxy_no_cache
predicates, or on cache node allocation errors if proxy_cache_bypass is
also used).

Reported by Valentin Bartenev.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3236,6 +3236,7 @@ ngx_http_upstream_send_response(ngx_http
 
     if (ngx_http_upstream_no_cache(r, u) != NGX_OK) {
         ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
+        return;
     }
 
     if (u->cacheable) {



More information about the nginx-devel mailing list