From 260e5e6c24ca6cfd618669336883d63fc1226740 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 13 Dec 2021 17:07:55 +0100 Subject: [PATCH] MINOR: quic: add missing lock on cid tree All operation on the ODCID/DCID trees must be conducted under a read-write lock. Add a missing read-lock on the lookup operation inside listener handler. --- src/xprt_quic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 6e30a363d..accadb75b 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4115,14 +4115,19 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end, } cids = &l->rx.cids; + + HA_RWLOCK_RDLOCK(QUIC_LOCK, &l->rx.cids_lock); node = ebmb_lookup(cids, *buf, QUIC_CID_LEN); if (!node) { + HA_RWLOCK_RDUNLOCK(QUIC_LOCK, &l->rx.cids_lock); TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT); goto err; } cid = ebmb_entry(node, struct quic_connection_id, node); qc = cid->qc; + HA_RWLOCK_RDUNLOCK(QUIC_LOCK, &l->rx.cids_lock); + if (HA_ATOMIC_LOAD(&qc->conn)) conn_ctx = HA_ATOMIC_LOAD(&qc->conn->xprt_ctx); *buf += QUIC_CID_LEN;