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.
This commit is contained in:
Amaury Denoyelle 2022-06-20 10:52:55 +02:00
parent 483499dc22
commit 2c31e12936
1 changed files with 7 additions and 0 deletions

View File

@ -4049,6 +4049,7 @@ static void quic_conn_release(struct quic_conn *qc)
struct ssl_sock_ctx *conn_ctx; struct ssl_sock_ctx *conn_ctx;
struct eb64_node *node; struct eb64_node *node;
struct quic_tls_ctx *app_tls_ctx; 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. */ /* We must not free the quic-conn if the MUX is still allocated. */
BUG_ON(qc->mux_state == QC_MUX_READY); 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); 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) { if (qc->idle_timer_task) {
task_destroy(qc->idle_timer_task); task_destroy(qc->idle_timer_task);
qc->idle_timer_task = NULL; qc->idle_timer_task = NULL;