From 41d9ab959a4cc14c99dffeb36ebd023294aeca93 Mon Sep 17 00:00:00 2001 From: Frederic Lecaille Date: Fri, 13 Nov 2026 18:26:44 +0100 Subject: [PATCH] BUG/MEDIUM: quic-be: keep the source port range of a closing backend connection When a backend QUIC connection enters the closing state, qc_new_cc_conn() moves its socket to a new quic_conn_closed instance. Since commit 02b768501 ("MEDIUM: fd: Remove fdinfo"), the source port range used to bind that socket is stored in qc->sport_range, but this member was not copied to the closing connection, and the quic_conn_closed pool is not zeroed. qc_release_fd() later installs qc->sport_range as the fd owner with FD_OWNER_PR, so that fd_delete() gives the port back to its range. With an uninitialized pointer, port_range_release_port() dereferences a wild address and the process dies on a general protection fault; when the field happens to be zero, the port is never released, so the range is exhausted after as many connections and every new backend connection fails with CO_ER_PORT_RANGE. Copy the source port range to the closing connection, as is already done for the other members it needs. It is always NULL on the frontend side. This bug was introduced by commit 02b768501, so it only affects 3.5-dev4 and later. No backport is needed. --- src/quic_conn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/quic_conn.c b/src/quic_conn.c index 1540d176e..8b5d75ee9 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -725,6 +725,11 @@ static struct quic_conn_closed *qc_new_cc_conn(struct quic_conn *qc) quic_conn_mv_cids_to_cc_conn(cc_qc, qc); + /* The source port range is needed to release the port of a backend + * socket with qc_release_fd(). It is always NULL on frontend side. + */ + cc_qc->sport_range = qc->sport_range; + if (qc_is_back(qc)) { cc_qc->fd = qc->fd; fdtab[cc_qc->fd].iocb = quic_conn_closed_sock_fd_iocb; -- 2.47.3