]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: quic: remove CID on BE conn alloc failure
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 Nov 2026 15:09:03 +0000 (16:09 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 13 Nov 2026 15:48:10 +0000 (16:48 +0100)
A QUIC backend connection is instantiated in qc_conn_init() via
xprt_quic. First, a random CID is generated and inserted into the tree.
On success, the quic-conn instance is allocated.

If the allocation fails, the CID is freed but not removed from the
global CID tree. This may cause a UAF issue later. Fix this by removing
the CID from the tree prior to freeing it.

This must be backported up to 3.3.

src/xprt_quic.c

index c2519fe8e77533a03764a0d317f50926938466a0..6a43c707f22feeb0372016bcaa70a10dcf70ca30 100644 (file)
@@ -167,6 +167,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
 
                qc = qc_new_conn(srv, NULL, NULL, conn, conn_id, NULL, &srv->addr);
                if (!qc) {
+                       quic_cid_delete(conn_id);
                        pool_free(pool_head_quic_connection_id, conn_id);
                        goto out;
                }