]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: free xprt tasklet on its thread
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 12 Jan 2022 13:54:23 +0000 (14:54 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 12 Jan 2022 14:21:27 +0000 (15:21 +0100)
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

index 514a9517e3681d02cf28fd439cd2261e78eca6a7..07dcbd72e485517d806802a9d949d26c45d43ff9 100644 (file)
@@ -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);
 }