]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: h1: prevent a crash on HTTP/2 upgrade
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 14 Nov 2025 11:42:38 +0000 (12:42 +0100)
committerOlivier Houchard <cognet@ci0.org>
Fri, 14 Nov 2025 11:49:35 +0000 (12:49 +0100)
commit333deef485377ac4ac047718a0d979d6fcaf07c6
treed208cb6e2aa5732c9203fbed8bfe4e2a2c6a86cb
parent2f8f09854f83179252e05ace14286459b5888418
BUG/MEDIUM: h1: prevent a crash on HTTP/2 upgrade

Change h1_process() to return -2 when the mux is destroyed but the
connection is not, so that we can differentiate between "both mux and
connection were destroyed" and "only the mux was destroyed".
It can happen that only the mux gets destroyed, and the connection is
still alive, if we did upgrade it to HTTP/2.
In h1_wake(), if the connection is alive, then return 0, as the wake
methods should only return -1 if the connection is dead.
This fixes a bug where the ssl xprt would consider the connection
destroyed, and thus would consider its tasklet should die, and return
NULL, and its TASK_RUNNING flag would never be removed, leading to an
infinite loop later on. This would happen anytime an HTTP/2 upgrade was
successful.

This should be backported up to 2.8. While the bug by commit
00f43b7c8b136515653bcb2fc014b0832ec32d61, it was not triggered before
only by chance, and exists in previous releases too.
src/mux_h1.c