mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: quic: Missing QUIC connection path member initialization
This bug was introduced by this commit: MINOR: quic: Remove pool_zalloc() from qc_new_conn(). If ->path is not initialized to NULL value, and if a QUIC connection object allocation has failed (from qc_new_conn()), haproxy could crash in quic_conn_prx_cntrs_update() when dereferencing this QUIC connection member. No backport needed.
This commit is contained in:
parent
0e53cb07a5
commit
7405874555
@ -5480,6 +5480,7 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
|
|||||||
qc->conn = NULL;
|
qc->conn = NULL;
|
||||||
qc->qcc = NULL;
|
qc->qcc = NULL;
|
||||||
qc->app_ops = NULL;
|
qc->app_ops = NULL;
|
||||||
|
qc->path = NULL;
|
||||||
|
|
||||||
/* Keyupdate: required to safely call quic_tls_ku_free() from
|
/* Keyupdate: required to safely call quic_tls_ku_free() from
|
||||||
* quic_conn_release().
|
* quic_conn_release().
|
||||||
@ -5652,6 +5653,10 @@ static inline void quic_conn_prx_cntrs_update(struct quic_conn *qc)
|
|||||||
HA_ATOMIC_ADD(&qc->prx_counters->sendto_err, qc->cntrs.sendto_err);
|
HA_ATOMIC_ADD(&qc->prx_counters->sendto_err, qc->cntrs.sendto_err);
|
||||||
HA_ATOMIC_ADD(&qc->prx_counters->sendto_err_unknown, qc->cntrs.sendto_err_unknown);
|
HA_ATOMIC_ADD(&qc->prx_counters->sendto_err_unknown, qc->cntrs.sendto_err_unknown);
|
||||||
HA_ATOMIC_ADD(&qc->prx_counters->sent_pkt, qc->cntrs.sent_pkt);
|
HA_ATOMIC_ADD(&qc->prx_counters->sent_pkt, qc->cntrs.sent_pkt);
|
||||||
|
/* It is possible that ->path was not initialized. For instance if a
|
||||||
|
* QUIC connection allocation has failed.
|
||||||
|
*/
|
||||||
|
if (qc->path)
|
||||||
HA_ATOMIC_ADD(&qc->prx_counters->lost_pkt, qc->path->loss.nb_lost_pkt);
|
HA_ATOMIC_ADD(&qc->prx_counters->lost_pkt, qc->path->loss.nb_lost_pkt);
|
||||||
HA_ATOMIC_ADD(&qc->prx_counters->conn_migration_done, qc->cntrs.conn_migration_done);
|
HA_ATOMIC_ADD(&qc->prx_counters->conn_migration_done, qc->cntrs.conn_migration_done);
|
||||||
/* Stream related counters */
|
/* Stream related counters */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user