]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: fix segfault on CC if mux uninitialized
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 3 Mar 2022 17:04:24 +0000 (18:04 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 3 Mar 2022 17:09:37 +0000 (18:09 +0100)
A segfault happens when receiving a CONNECTION_CLOSE during handshake.
This is because the mux is not initialized at this stage but the
transport layer dereferences it.

Fix this by ensuring that the MUX is initialized before. Thanks to Willy
for his help on this one. Welcome in the QUIC-men team !

src/xprt_quic.c

index 5c260eaab53c188155293f17641fbd1c7af5b073..34c4811a0bbe9750d3e0039494e6738d32ec9e0c 100644 (file)
@@ -2393,9 +2393,10 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct
                case QUIC_FT_CONNECTION_CLOSE:
                case QUIC_FT_CONNECTION_CLOSE_APP:
                        /* warn the mux to close the connection */
-                       if (qc->mux_state == QC_MUX_READY)
+                       if (qc->mux_state == QC_MUX_READY) {
                                qc->qcc->flags |= QC_CF_CC_RECV;
-                       tasklet_wakeup(qc->qcc->wait_event.tasklet);
+                               tasklet_wakeup(qc->qcc->wait_event.tasklet);
+                       }
                        break;
                case QUIC_FT_HANDSHAKE_DONE:
                        if (qc_is_listener(ctx->qc))