From 59b07c737b77bc8c3c60ea5f0f8ae59f7a95d5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 3 Aug 2021 16:06:01 +0200 Subject: [PATCH] MINOR: quic: Atomically handle packet number space ->largest_acked_pn variable Protect this variable (largest acked packet number) from any concurrent access. --- src/xprt_quic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 8cf3bcbc4..6f111ba0e 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -1344,7 +1344,7 @@ static void qc_packet_loss_lookup(struct quic_pktns *pktns, unsigned int loss_time_limit, time_sent; pkt = eb64_entry(&node->node, struct quic_tx_packet, pn_node); - largest_acked_pn = pktns->tx.largest_acked_pn; + largest_acked_pn = HA_ATOMIC_LOAD(&pktns->tx.largest_acked_pn); node = eb64_next(node); if ((int64_t)pkt->pn_node.key > largest_acked_pn) break; @@ -1403,7 +1403,7 @@ static inline int qc_parse_ack_frm(struct quic_frame *frm, struct ssl_sock_ctx * largest_node = NULL; time_sent = 0; - if ((int64_t)ack->largest_ack > qel->pktns->tx.largest_acked_pn) { + if ((int64_t)ack->largest_ack > HA_ATOMIC_LOAD(&qel->pktns->tx.largest_acked_pn)) { largest_node = eb64_lookup(pkts, largest); if (!largest_node) { TRACE_DEVEL("Largest acked packet not found", @@ -1458,7 +1458,7 @@ static inline int qc_parse_ack_frm(struct quic_frame *frm, struct ssl_sock_ctx * if (time_sent && (pkt_flags & QUIC_FL_TX_PACKET_ACK_ELICITING)) { *rtt_sample = tick_remain(time_sent, now_ms); - qel->pktns->tx.largest_acked_pn = ack->largest_ack; + HA_ATOMIC_STORE(&qel->pktns->tx.largest_acked_pn, ack->largest_ack); } if (!LIST_ISEMPTY(&newly_acked_pkts)) {