]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mux-quic: fix crash on frame alloc failure after glitch error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 27 Nov 2026 15:54:35 +0000 (16:54 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 30 Nov 2026 10:03:29 +0000 (11:03 +0100)
App layer rcv_buf callback may report a connection error using
qcc_set_error(). A negative return value must be used to abort remaining
processing in qcc_decode_qcs().

However, this was not the case when the connection was set on error
because of the glitch level counter. Some work is thus still being
executed, most notably the stream and connection flow-control accounting
via qcs_consume(). This is suboptimal as the connection will soon be
released.

Worse, this may cause a crash if a flow-control frame allocation fails,
as qcc_set_error() is called again. This is forbidden and a BUG_ON() is
used to catch it.

Add a check on the new QC_CF_GLITCH flag after rcv_buf(). If set,
qcc_decode_qcs() is interrupted and qcs_consume() is skipped, so that
the connection can be quickly released.

This must be backported up to 3.0. It relies on the following patch.
  a4ae233d42315a77dec78fc573ab606748f9dcaf
  MINOR: mux-quic: add conn flag on glitch error set

src/mux_quic.c

index e4a515bc035d936ee9e913abdca467910a72dbb1..ce7ba7d384fb28b0e69056638c08e559e99bced1 100644 (file)
@@ -1516,8 +1516,16 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
        if (!(qcs->flags & QC_SF_READ_ABORTED)) {
                ret = qcc->app_ops->rcv_buf(qcs, &b, fin);
 
-               if (qcc->glitches != prev_glitches && !(qcc->flags & QC_CF_IS_BACK))
-                       session_add_glitch_ctr(qcc->conn->owner, qcc->glitches - prev_glitches);
+               if (qcc->glitches != prev_glitches) {
+                       if (!(qcc->flags & QC_CF_IS_BACK))
+                               session_add_glitch_ctr(qcc->conn->owner, qcc->glitches - prev_glitches);
+
+                       if (qcc->flags & QC_CF_GLITCH) {
+                               TRACE_ERROR("glitch level counter hit", QMUX_EV_QCS_RECV, qcc->conn, qcs);
+                               ret = -1;
+                               goto err;
+                       }
+               }
 
                if (ret < 0) {
                        TRACE_ERROR("decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);