From 2c31e1293661cd44b71457b8fd0567b08ef95b0b Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 20 Jun 2022 10:52:55 +0200 Subject: [PATCH] BUG/MINOR: quic: purge conn Rx packet list on release When releasing a quic_conn instance, free all remaining Rx packets in quic_conn.rx.pkt_list. This partially fixes a memory leak on Rx packets which can be observed after several QUIC connections establishment. This should partially resolve github issue #1751. It must be backported up to 2.6. --- src/xprt_quic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index d78eecf27..b1ef28e29 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4049,6 +4049,7 @@ static void quic_conn_release(struct quic_conn *qc) struct ssl_sock_ctx *conn_ctx; struct eb64_node *node; struct quic_tls_ctx *app_tls_ctx; + struct quic_rx_packet *pkt, *pktback; /* We must not free the quic-conn if the MUX is still allocated. */ BUG_ON(qc->mux_state == QC_MUX_READY); @@ -4068,6 +4069,12 @@ static void quic_conn_release(struct quic_conn *qc) qc_stream_desc_free(stream); } + /* Purge Rx packet list. */ + list_for_each_entry_safe(pkt, pktback, &qc->rx.pkt_list, qc_rx_pkt_list) { + LIST_DELETE(&pkt->qc_rx_pkt_list); + pool_free(pool_head_quic_rx_packet, pkt); + } + if (qc->idle_timer_task) { task_destroy(qc->idle_timer_task); qc->idle_timer_task = NULL;