From 9ab2fb39215243ad33362ddc82309a0494867cf7 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 12 Jan 2022 14:54:23 +0100 Subject: [PATCH] MINOR: quic: free xprt tasklet on its thread Free the ssl_sock_ctx tasklet in quic_close() instead of quic_conn_drop(). This ensures that the tasklet is destroyed safely by the same thread. This has no impact as the free operation was previously conducted with care and should not be responsible of any crash. --- src/xprt_quic.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 514a9517e..07dcbd72e 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -3328,12 +3328,8 @@ static void quic_conn_drop(struct quic_conn *qc) HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qc->li->rx.cids_lock); conn_ctx = HA_ATOMIC_LOAD(&qc->xprt_ctx); - if (conn_ctx) { - tasklet_free(conn_ctx->wait_event.tasklet); - conn_ctx->wait_event.tasklet = NULL; - + if (conn_ctx) pool_free(pool_head_quic_conn_ctx, conn_ctx); - } for (i = 0; i < QUIC_TLS_ENC_LEVEL_MAX; i++) quic_conn_enc_level_uninit(&qc->els[i]); @@ -3355,6 +3351,11 @@ void quic_close(struct connection *conn, void *xprt_ctx) qc->timer_task = NULL; } + if (conn_ctx->wait_event.tasklet) { + tasklet_free(conn_ctx->wait_event.tasklet); + conn_ctx->wait_event.tasklet = NULL; + } + quic_conn_drop(qc); TRACE_LEAVE(QUIC_EV_CONN_CLOSE, qc); }