]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: connection: streamline conn detach from lists
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 4 Sep 2025 14:26:19 +0000 (16:26 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 4 Sep 2025 16:31:20 +0000 (18:31 +0200)
commit687df405fe6c1bd95fdebba03f3491c26f82692d
treedb2cb4d469de18b3963f9580b36edf2f41839270
parent27ff7ff296dec073e84cf03106a3e285181c24d8
BUG/MINOR: connection: streamline conn detach from lists

Over their lifetime, connections are attached to different list. These
lists depends on whether connection is on frontend or backend side.
Attach point members are stored via a union in struct connection. The
next commit reorganizes them so that a proper frontend/backend
separation is performed :

  commit a96f1286a75246fef6db3e615fabdef1de927d83
  BUG/MINOR: connection: rearrange union list members

On conn_free(), connection instance must be removed from these lists to
ensure there is no use-after-free case. However code was still shaky
there, despite no real issue. Indeed, <toremove_list> was detached for
all connections, despite being only used on backend side only.

This patch streamlines the freeing of connection. Now, <toremove_list>
detach is performed in conn_backend_deinit(). Moreover, a new helper
conn_frontend_deinit() is defined. It ensures that <stopping_list>
detach is done. Prior it was performed individually by muxes.

Note that a similar procedure is performed when the connection is
reversed. Hence, conn_frontend_deinit() is now used here as well,
rendering reversal from FE to BE or vice versa symmetrical.

As mentionned above, no crash occured prior to this patch, but the code
was fragile, in particular access to <toremove_list> for frontend
connections. Thus this patch is considered as a bug fix worthy of a
backport along with above mentionned patch, currently up to 3.0.
src/connection.c
src/mux_h1.c
src/mux_h2.c
src/mux_quic.c