From 9054d1b5645f150c5c60dcca8cc2094608fe5961 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Mon, 26 Jul 2021 16:23:53 +0200 Subject: [PATCH] MINOR: quic: Missing encryption level rx.crypto member initialization and lock. ->rx.crypto member of quic_enc_level struct was not initialized as this was done for all other members of this structure. This patch fixes this. Also adds a RW lock for the frame of this member. --- include/haproxy/xprt_quic-t.h | 4 +++- src/xprt_quic.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index b83c34e..41d585c 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -544,7 +544,9 @@ struct quic_enc_level { /* Crypto frames */ struct { uint64_t offset; - struct eb_root frms; /* XXX TO CHECK XXX */ + struct eb_root frms; + /* must be protected from concurrent accesses */ + __decl_thread(HA_RWLOCK_T frms_rwlock); } crypto; } rx; struct { diff --git a/src/xprt_quic.c b/src/xprt_quic.c index eec3b5c..cc560a9 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2719,6 +2719,9 @@ static int quic_conn_enc_level_init(struct quic_conn *qc, qel->rx.pkts = EB_ROOT; HA_RWLOCK_INIT(&qel->rx.rwlock); MT_LIST_INIT(&qel->rx.pqpkts); + qel->rx.crypto.offset = 0; + qel->rx.crypto.frms = EB_ROOT_UNIQUE; + HA_RWLOCK_INIT(&qel->rx.crypto.frms_rwlock); /* Allocate only one buffer. */ qel->tx.crypto.bufs = malloc(sizeof *qel->tx.crypto.bufs); -- 1.7.10.4