]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: check sc_attach_mux return value
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Jun 2025 08:46:05 +0000 (10:46 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 16 Jun 2025 16:11:09 +0000 (18:11 +0200)
On backend side, QUIC MUX needs to initialize the first local stream
during MUX init operation. This is necessary so that the first transfer
can then be performed.

sc_attach_mux() is used to attach the created QCS instance to its stream
data layer. However, return value was not checked, which may cause
issues on allocation error. This patch fixes it by returning an error on
MUX init operation and freeing the QCS instance in case of
sc_attach_mux() error.

This fixes coverity report from github issue #3007.

No need to backport.

src/mux_quic.c

index b3fcd65170bc0a655774e1eaf59e4b3c0eff1f67..af8285818a220eef591c43fe5109a24c6b00f450 100644 (file)
@@ -3570,7 +3570,13 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
                        goto err;
                }
 
-               sc_attach_mux(sc, qcs, conn);
+               if (sc_attach_mux(sc, qcs, conn)) {
+                       TRACE_ERROR("Cannot attach backend first init stream",
+                                   QMUX_EV_QCC_NEW|QMUX_EV_QCC_ERR, conn);
+                       qcs_free(qcs);
+                       goto err;
+               }
+
                qcs->sd = sc->sedesc;
                qcc->nb_sc++;
        }