]> git.ipfire.org Git - thirdparty/openssl.git/commit
quic: fix incoming port cleanup on failure master
authorNikola Pajkovsky <nikolap@openssl.org>
Mon, 4 May 2026 20:47:04 +0000 (22:47 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 12 May 2026 12:00:59 +0000 (08:00 -0400)
commitde68b193a580ea2fdc800ee08cb30b4c28601a22
treed3d37104c38802b1d42d94be811ad06657b4f77c
parent51e7447e9ed72efba16570110eb6187df85d1a79
quic: fix incoming port cleanup on failure

port_make_channel() builds an incoming QUIC channel in stages: allocate
the channel, create the user SSL and inner TLS objects, optionally copy
qlog state, then initialise the channel. Under the mfail allocator,
failures in the middle of that sequence could leave ownership split
between the partially-created channel and the user SSL, leaking
allocations from ossl_quic_channel_alloc().

Make port_new_handshake_layer() return the created user SSL to
port_make_channel() and detach the borrowed channel before cleaning up
its own failures. port_make_channel() now owns the error path: it
detaches any created user SSL from the channel, frees the channel exactly
once according to whether channel initialisation already ran cleanup, and
then frees the user SSL.

Also make QUIC stream map cleanup tolerate a NULL map during partial
channel cleanup, and add a focused mfail regression test for
ossl_quic_port_create_incoming().

Fixes: https://github.com/openssl/openssl/issues/31014
Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Tue May 12 12:01:04 2026
(Merged from https://github.com/openssl/openssl/pull/31038)
include/internal/quic_port.h
ssl/quic/quic_impl.c
ssl/quic/quic_port.c
ssl/quic/quic_port_local.h
test/build.info
test/quic_memfail_test.c [new file with mode: 0644]
test/recipes/90-test_quic_memfail.t [new file with mode: 0644]