]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Missing TX packet deallocations
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 1 Apr 2022 10:15:24 +0000 (12:15 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 1 Apr 2022 14:26:06 +0000 (16:26 +0200)
Ensure all TX packets are deallocated. There may be remaining ones which
will never be acknowledged or deemed lost.

include/haproxy/xprt_quic.h
src/xprt_quic.c

index 09c19ce386ffa92e44d83d3048c37bbd626da673..9bf71e9064d7b9e93a0ac3c4c314c839f85854b9 100644 (file)
@@ -1018,27 +1018,10 @@ static inline void quic_tx_packet_refdec(struct quic_tx_packet *pkt)
        }
 }
 
-/* Discard <pktns> packet number space attached to <qc> QUIC connection.
- * Its loss information are reset. Deduce the outstanding bytes for this
- * packet number space from the outstanding bytes for the path of this
- * connection.
- * Note that all the non acknowledged TX packets and their frames are freed.
- * Always succeeds. 
- */
-static inline void quic_pktns_discard(struct quic_pktns *pktns,
-                                      struct quic_conn *qc)
+static inline void quic_pktns_tx_pkts_release(struct quic_pktns *pktns)
 {
        struct eb64_node *node;
 
-       qc->path->in_flight -= pktns->tx.in_flight;
-       qc->path->prep_in_flight -= pktns->tx.in_flight;
-       qc->path->loss.pto_count = 0;
-
-       pktns->tx.time_of_last_eliciting = 0;
-       pktns->tx.loss_time = TICK_ETERNITY;
-       pktns->tx.pto_probe = 0;
-       pktns->tx.in_flight = 0;
-
        node = eb64_first(&pktns->tx.pkts);
        while (node) {
                struct quic_tx_packet *pkt;
@@ -1056,6 +1039,27 @@ static inline void quic_pktns_discard(struct quic_pktns *pktns,
        }
 }
 
+/* Discard <pktns> packet number space attached to <qc> QUIC connection.
+ * Its loss information are reset. Deduce the outstanding bytes for this
+ * packet number space from the outstanding bytes for the path of this
+ * connection.
+ * Note that all the non acknowledged TX packets and their frames are freed.
+ * Always succeeds.
+ */
+static inline void quic_pktns_discard(struct quic_pktns *pktns,
+                                      struct quic_conn *qc)
+{
+       qc->path->in_flight -= pktns->tx.in_flight;
+       qc->path->prep_in_flight -= pktns->tx.in_flight;
+       qc->path->loss.pto_count = 0;
+
+       pktns->tx.time_of_last_eliciting = 0;
+       pktns->tx.loss_time = TICK_ETERNITY;
+       pktns->tx.pto_probe = 0;
+       pktns->tx.in_flight = 0;
+       quic_pktns_tx_pkts_release(pktns);
+}
+
 /* Initialize <p> QUIC network path depending on <ipv4> boolean
  * which is true for an IPv4 path, if not false for an IPv6 path.
  */
index 32e293f64c9d4f432c6b57f0bbc43ea4a70a7c55..10d3285d284e4bb6f624c197f411a2e6d8edb0b3 100644 (file)
@@ -3802,8 +3802,10 @@ static void quic_conn_release(struct quic_conn *qc)
        pool_free(pool_head_quic_tls_secret, app_tls_ctx->rx.secret);
        pool_free(pool_head_quic_tls_secret, app_tls_ctx->tx.secret);
 
-       for (i = 0; i < QUIC_TLS_PKTNS_MAX; i++)
+       for (i = 0; i < QUIC_TLS_PKTNS_MAX; i++) {
+               quic_pktns_tx_pkts_release(&qc->pktns[i]);
                quic_free_arngs(&qc->pktns[i].rx.arngs);
+       }
 
        pool_free(pool_head_quic_conn_rxbuf, qc->rx.buf.area);
        pool_free(pool_head_quic_conn, qc);