Skip to content

Commit 9e91316

Browse files
a-denoyellecapflam
authored andcommitted
BUG/MINOR: quic: fix race-condition on trace for CID retrieval
quic_rx_pkt_retrieve_conn() is used when parsing a received datagram from the listener socket. It returned the quic_conn instance corresponding to the first packet DCID, unless it is mapped to another thread. As expected, global CID tree access is protected by a lock in the function. However, there is a race condition due to the final trace where qc instance is dereferenced outside of the lock. Fix this by adding a new trace under lock protection and remove qc deferencement at function end. This may fix first crash of github issue #2607. This must be backported up to 2.8. (cherry picked from commit bbb9f82) Signed-off-by: Christopher Faulet <[email protected]>
1 parent 177bcf3 commit 9e91316

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/quic_cid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ struct quic_conn *retrieve_qc_conn_from_cid(struct quic_rx_packet *pkt,
257257
goto end;
258258
}
259259
qc = conn_id->qc;
260+
TRACE_DEVEL("found connection", QUIC_EV_CONN_RXPKT, qc);
260261

261262
end:
262263
HA_RWLOCK_RDUNLOCK(QC_CID_LOCK, &tree->lock);
263-
TRACE_LEAVE(QUIC_EV_CONN_RXPKT, qc);
264+
TRACE_LEAVE(QUIC_EV_CONN_RXPKT);
264265
return qc;
265266
}
266267

0 commit comments

Comments
 (0)