]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 20 Nov 2026 16:30:57 +0000 (17:30 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 20 Nov 2026 16:43:48 +0000 (17:43 +0100)
commit383e07a8787ab9f838158daf74c0d75961bb133e
treeb1efe1003a57c572a9e10e45fe86fd59a018ea8a
parenta2c90b26f70fe8bc5546f89550908b1277751018
BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)

In qc_notify_cc_of_newly_acked_pkts() the ->rs.delivered field of a TX
packet is unconditionally read for each newly acknowledged packet. But
->rs is filled in at TX time by quic_cc_drs_on_pkt_sent() (called from
drs_on_transmit() under QUIC_FL_TX_PACKET_ACK_ELICITING guard) for
ack-eliciting packets only. For a non ack-eliciting packet, e.g. a pure
ACK packet, which can be acknowledged by a peer, ->rs has never been
written and this read returns an indeterminate value.

This value is consumed by quic_cc_drs_on_ack_recv() and on_ack_rcvd()
which may corrupt the delivery rate sampling round counting
(drs->round_count, drs->next_round_delivered): a stale value from a
previously recycled packet freezes the round detection, a null one
spuriously increments round_count. Only BBR is affected: cubic neither
provides get_drs() nor on_ack_rcvd().

Fix this by reading ->rs.delivered for ack-eliciting packets only, as
already done for the call to quic_cc_drs_update_rate_sample() just
below, and for on_pkt_lost() in quic_loss.c. Also document in
quic_tx_packet_init() that ->rs is deliberately left uninitialized and
must never be read for a non ack-eliciting packet.

Thank you to @brhenc for having reported this bug in GH #3587.

This bug was introduced by 44af88d85 ("MINOR: quic: RX part
modifications to support BBR") with the delivery rate sampling support.
This must be backported up to v3.2.
src/quic_rx.c
src/quic_tx.c