mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
MINOR: quic: add 2 BUG_ON() on datagram dispatch
QUIC datagram dispatch is an error prone operation as it must always ensure the correct thread is used before accessing to the recipient quic_conn instance. Strengthen this code part by adding two BUG_ON_HOT() to ensure thread safety.
This commit is contained in:
parent
8550549cca
commit
a4240fb26f
@ -1571,6 +1571,9 @@ static struct quic_conn *quic_rx_pkt_retrieve_conn(struct quic_rx_packet *pkt,
|
|||||||
|
|
||||||
qc = retrieve_qc_conn_from_cid(pkt, &dgram->saddr, new_tid);
|
qc = retrieve_qc_conn_from_cid(pkt, &dgram->saddr, new_tid);
|
||||||
|
|
||||||
|
/* quic_conn must be set to NULL if bind on another thread. */
|
||||||
|
BUG_ON_HOT(qc && *new_tid != -1);
|
||||||
|
|
||||||
/* If connection already created or rebinded on another thread. */
|
/* If connection already created or rebinded on another thread. */
|
||||||
if (!qc && *new_tid != -1 && tid != *new_tid)
|
if (!qc && *new_tid != -1 && tid != *new_tid)
|
||||||
goto out;
|
goto out;
|
||||||
@ -2161,6 +2164,10 @@ int quic_dgram_parse(struct quic_dgram *dgram, struct quic_conn *from_qc,
|
|||||||
dgram->qc = qc;
|
dgram->qc = qc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ensure quic_conn access only occurs on its attached thread. */
|
||||||
|
BUG_ON_HOT(((struct quic_connection_id *)
|
||||||
|
eb64_entry(eb64_first(qc->cids), struct quic_connection_id, seq_num))->tid != tid);
|
||||||
|
|
||||||
/* Ensure thread connection migration is finalized ASAP. */
|
/* Ensure thread connection migration is finalized ASAP. */
|
||||||
if (qc->flags & QUIC_FL_CONN_AFFINITY_CHANGED)
|
if (qc->flags & QUIC_FL_CONN_AFFINITY_CHANGED)
|
||||||
qc_finalize_affinity_rebind(qc);
|
qc_finalize_affinity_rebind(qc);
|
||||||
|
Loading…
Reference in New Issue
Block a user