]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: ssl: fix trace crash on BE conn release in io cb
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 6 Oct 2026 07:45:37 +0000 (09:45 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 6 Oct 2026 09:10:53 +0000 (11:10 +0200)
Since 3.3, handling of idle connections in io handler for muxes/SSL has
been extended. On io completion, connection is not reinserted anymore in
the server list if it is in maintenance mode. Also, private connections
are need race protection as they may be purged : on completion, a
connection is reinserted in its parent session. This operation is
failible as it may require an allocation.

In SSL io tasklet, if a BE connection is not reinserted in its idle pool
for one of the two reasons described above, it is freed instead via MUX
destroy callback. This causes a crash if traces are activated as conn
pointer is not updated.

Fix this by ensuring conn pointer is set to NULL after destroy
invokation.

This must be backported up to 3.3.

src/ssl_sock.c

index d45547eb4e76e3d6039094ebbd308107ec717004..f34ea6ddb96e9fd5b71c717a6e61e6a1804f64d5 100644 (file)
@@ -7481,6 +7481,7 @@ leave:
                                if (!session_reinsert_idle_conn(conn->owner, conn)) {
                                        /* session add conn failure */
                                        CALL_MUX_NO_RET(conn->mux, destroy(conn->ctx));
+                                       conn = NULL;
                                        t = NULL;
                                }
                        }
@@ -7493,6 +7494,7 @@ leave:
                else {
                        /* Do not store an idle conn if server in maintenance. */
                        CALL_MUX_NO_RET(conn->mux, destroy(conn->ctx));
+                       conn = NULL;
                        t = NULL;
                }
        }