]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: prevent a crash in session_free on mux.destroy
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 13 Apr 2022 14:54:52 +0000 (16:54 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 14 Apr 2022 12:50:12 +0000 (14:50 +0200)
Implement qc_destroy. This callback is used to quickly release all MUX
resources.

session_free uses this callback. Currently, it can only be called if
there was an error during connection initialization. If not defined, the
process crashes.

src/mux_quic.c

index 58e4759d04947984f658cf9b772ec4615155b64f..a4ffe97c764d04d55906209132f76f2edf5ab36a 100644 (file)
@@ -1057,6 +1057,15 @@ static int qc_init(struct connection *conn, struct proxy *prx,
        return -1;
 }
 
+static void qc_destroy(void *ctx)
+{
+       struct qcc *qcc = ctx;
+
+       TRACE_ENTER(QMUX_EV_QCC_END, qcc->conn);
+       qc_release(qcc);
+       TRACE_LEAVE(QMUX_EV_QCC_END);
+}
+
 static void qc_detach(struct conn_stream *cs)
 {
        struct qcs *qcs = __cs_mux(cs);
@@ -1346,6 +1355,7 @@ INITCALL0(STG_INIT, qmux_init_stdout_traces);
 
 static const struct mux_ops qc_ops = {
        .init = qc_init,
+       .destroy = qc_destroy,
        .detach = qc_detach,
        .rcv_buf = qc_rcv_buf,
        .snd_buf = qc_snd_buf,