]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: mux-fcgi: don't call fcgi_strm_destroy() on a NULL stream
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 6 Aug 2026 07:26:05 +0000 (09:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Aug 2026 08:29:19 +0000 (10:29 +0200)
commit7592771f0c6ffa47a6eaba328216c425ffe5c3be
tree4cb03ee8941cbad2525e557e5c40f2c3200ff01f
parentc4184069d4cd2cd21090664825c030455de6e948
BUG/MINOR: mux-fcgi: don't call fcgi_strm_destroy() on a NULL stream

fcgi_stconn_new() has three "goto out" taken before the stream is allocated
(streams limit reached, no stream left) or when the allocation failed, and
the out label unconditionally calls fcgi_strm_destroy(), which dereferences
<fstrm> right away. So a failure to allocate the stream or its tasklet
crashes instead of returning a clean error. The first two paths are
normally prevented by the reuse layer which checks avail_streams first.

Let's just skip the destruction when the stream is NULL.

This came with commit 070b91bc1 ("MEDIUM: conn-stream: Be prepared to fail
to attach a cs to a mux") in 2.6, which added this destroy call for the new
sc_attach_mux() failure path without protecting the pre-existing ones (the
other muxes did it right). It must be backported to all stable versions.

Reported-by: Claude (ANT-2026-VN29N97G)
src/mux_fcgi.c