]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mux-quic: fix QMux Rx buffer leak on MUX init failure
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 18 Nov 2026 15:55:27 +0000 (16:55 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 18 Nov 2026 16:07:16 +0000 (17:07 +0100)
On QMux, qcm_init() takes over the Rx buffer of the xprt layer. When it
fails later, its error path resets qcc->conn before calling
qcc_release(), which only releases the QMux connection buffers when a
connection is attached, so the Rx buffer is leaked. A client connecting
with TLS but without ALPN to a "proto qmux" listener makes
qcc_install_app_ops() fail and leaks one buffer per connection.

Let's release the QMux Rx buffer in the qcm_init() error path, where the
connection type is still known. The Tx one cannot be allocated yet.

This was introduced in 3.4 by commit 81f22cd68 ("MINOR: mux-quic: define
Rx connection buffer for QMux") and must be backported to 3.4.

src/mux_quic.c

index b41eedb3141312160ab0c1ac9f6833b126a440c4..d00aaeb8cb78ce64b6f544364e0c5e1021d1346d 100644 (file)
@@ -4325,6 +4325,12 @@ static int qcm_init(struct connection *conn, struct proxy *prx,
        }
 
        if (qcc) {
+               /* qcc_release() cannot free the QMux Rx buffer without conn */
+               if (!conn_is_quic(conn)) {
+                       b_free(&qcc->rx.qmux_buf);
+                       offer_buffers(NULL, 1);
+               }
+
                /* In case of MUX init failure, session will ensure connection is freed. */
                qcc->conn = NULL;
                qcc_release(qcc);