]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Missing encryption level rx.crypto member initialization and lock.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 26 Jul 2021 14:23:53 +0000 (16:23 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
->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
src/xprt_quic.c

index b83c34e6e82edc4caee2f6bdfa7c78dfaefae762..41d585c04a4b9d4fb542f0a1b7ac2eb620e1f524 100644 (file)
@@ -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;
+                       /* <frms> must be protected from concurrent accesses */
+                       __decl_thread(HA_RWLOCK_T frms_rwlock);
                } crypto;
        } rx;
        struct {
index eec3b5cd00652659c080ffd6a758ac6b0ce8bf89..cc560a92e13599a37ba41227e7c9599c6d6b8cd1 100644 (file)
@@ -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);