]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: h3: remove dead code on h3_rcv_buf() error path
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 19 Oct 2026 11:55:19 +0000 (13:55 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 20 Oct 2026 08:51:47 +0000 (10:51 +0200)
Previous patches rework error handling and glitch reporting in
h3_rcv_buf() after a connection level error occured. A similar pattern
is adopted after each frame parsers : when a connection level error is
encountered, glitch is incremented and parsing is immediately
interrupted using early return via err label.

To ensure the code remains safe though with future evolution, h3c <err>
check on h3_rcv_buf() epilogue is replaced so that qcc_set_error() is
only set if not already done, which is currently unnecessary. A
WARN_ON() should help to detect such cases.

src/h3.c

index be9cd7470829ec663ff1be36e670d35208cbf79c..b4946fbc68326eb724d9d959b02cfa53a0b045e8 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -2274,6 +2274,14 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
                }
        }
 
+       if (unlikely(h3c->err)) {
+               /* Should be dead code : err conn must be handled directly after frame parsing and redirected to err label. */
+               WARN_ON(1, "h3c error not correctly handled");
+               if (!(qcs->qcc->flags & (QC_CF_ERR_CONN|QC_CF_ERRL)))
+                       qcc_set_error(qcs->qcc, h3c->err, 1, muxc_tevt_type_proto_err);
+               goto err;
+       }
+
        /* Reset demux frame type for traces. */
        if (!h3s->demux_frame_len)
                h3s->demux_frame_type = H3_FT_UNINIT;
@@ -2288,11 +2296,6 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
                total += b_data(b);
                goto done;
        }
-       else if (h3c->err) {
-               qcc_set_error(qcs->qcc, h3c->err, 1, muxc_tevt_type_proto_err);
-               total += b_data(b);
-               goto done;
-       }
        else if (unlikely(ret < 0)) {
                qcc_set_error(qcs->qcc, H3_ERR_INTERNAL_ERROR, 1, muxc_tevt_type_internal_err);
                goto err;