MINOR: quic: Add TX packets at the very last time to their tree.

If we add TX packets to their trees before sending them, they may
be detected as lost before being sent. This may make haproxy crash
when it retreives the prepared packets from TX ring buffers, dereferencing
them after they have been freed.
This commit is contained in:
Frédéric Lécaille 2021-07-19 14:48:36 +02:00 committed by Amaury Denoyelle
parent b095252a23
commit 0eb60c5b4d

View File

@ -2221,6 +2221,7 @@ int qc_send_ppkts(struct qring *qr, struct ssl_sock_ctx *ctx)
qc_set_timer(ctx); qc_set_timer(ctx);
TRACE_PROTO("sent pkt", QUIC_EV_CONN_SPPKTS, ctx->conn, pkt); TRACE_PROTO("sent pkt", QUIC_EV_CONN_SPPKTS, ctx->conn, pkt);
next_pkt = pkt->next; next_pkt = pkt->next;
eb64_insert(&pkt->pktns->tx.pkts, &pkt->pn_node);
quic_tx_packet_refdec(pkt); quic_tx_packet_refdec(pkt);
} }
} }
@ -3931,7 +3932,6 @@ static struct quic_tx_packet *qc_build_hdshk_pkt(unsigned char **pos,
qc->path->prep_in_flight += pkt->len; qc->path->prep_in_flight += pkt->len;
} }
pkt->pktns = qel->pktns; pkt->pktns = qel->pktns;
eb64_insert(&qel->pktns->tx.pkts, &pkt->pn_node);
TRACE_LEAVE(QUIC_EV_CONN_HPKT, qc->conn, pkt); TRACE_LEAVE(QUIC_EV_CONN_HPKT, qc->conn, pkt);
return pkt; return pkt;
@ -4132,7 +4132,6 @@ static struct quic_tx_packet *qc_build_phdshk_apkt(unsigned char **pos,
qc->path->prep_in_flight += pkt->len; qc->path->prep_in_flight += pkt->len;
} }
pkt->pktns = qel->pktns; pkt->pktns = qel->pktns;
eb64_insert(&qel->pktns->tx.pkts, &pkt->pn_node);
TRACE_LEAVE(QUIC_EV_CONN_PAPKT, qc->conn, pkt); TRACE_LEAVE(QUIC_EV_CONN_PAPKT, qc->conn, pkt);
return pkt; return pkt;