From: Frédéric Lécaille Date: Wed, 12 Jan 2022 08:46:02 +0000 (+0100) Subject: MINOR: quic: Do not dereference ->conn quic_conn struct member X-Git-Tag: v2.6-dev1~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1aa57d32bbe2f4bb8d1af4de4ff8777afcfafd7b;p=thirdparty%2Fhaproxy.git MINOR: quic: Do not dereference ->conn quic_conn struct member ->conn quic_conn struct member is a connection struct object which may be released from several places. With this patch we do our best to stop dereferencing this member as much as we can. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index d413b4eb19..23eae2239a 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -589,7 +589,7 @@ static inline int quic_peer_validated_addr(struct quic_conn *qc) { struct quic_pktns *hdshk_pktns, *app_pktns; - if (objt_server(qc->conn->target)) + if (!qc_is_listener(qc)) return 1; hdshk_pktns = qc->els[QUIC_TLS_ENC_LEVEL_HANDSHAKE].pktns; @@ -2597,7 +2597,7 @@ static int qc_prep_pkts(struct quic_conn *qc, struct qring *qr, padding = 0; } else if (prv_pkt->type == QUIC_TLS_ENC_LEVEL_INITIAL && - (objt_server(qc->conn->target) || + (!qc_is_listener(qc) || prv_pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING)) { padding = 1; } @@ -2719,7 +2719,7 @@ static int quic_build_post_handshake_frames(struct quic_conn *qc) qel = &qc->els[QUIC_TLS_ENC_LEVEL_APP]; /* Only servers must send a HANDSHAKE_DONE frame. */ - if (!objt_server(qc->conn->target)) { + if (qc_is_listener(qc)) { frm = pool_alloc(pool_head_quic_frame); if (!frm) return 0; @@ -3392,7 +3392,7 @@ static struct task *process_timer(struct task *task, void *ctx, unsigned int sta qc->pktns[QUIC_TLS_PKTNS_INITIAL].tx.pto_probe = 1; pktns->tx.pto_probe = 1; } - else if (objt_server(qc->conn->target) && st <= QUIC_HS_ST_COMPLETE) { + else if (!qc_is_listener(qc) && st <= QUIC_HS_ST_COMPLETE) { struct quic_enc_level *iel = &qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]; struct quic_enc_level *hel = &qc->els[QUIC_TLS_ENC_LEVEL_HANDSHAKE];