From 2010a5b8d915beebd64c68cb568b03c29ab64d75 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Mon, 24 Jul 2023 22:38:27 +0200 Subject: [PATCH] [IP] Unlock Connection when TCPAllocatePort() fails. CORE-18371 Addendum to 874d317 (0.4.15-dev-5707, #5074). --- drivers/network/tcpip/ip/transport/tcp/accept.c | 1 + drivers/network/tcpip/ip/transport/tcp/tcp.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/network/tcpip/ip/transport/tcp/accept.c b/drivers/network/tcpip/ip/transport/tcp/accept.c index 4d12c527fae..cfab933003d 100644 --- a/drivers/network/tcpip/ip/transport/tcp/accept.c +++ b/drivers/network/tcpip/ip/transport/tcp/accept.c @@ -82,6 +82,7 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog) if (AllocatedPort == (UINT) -1) { DbgPrint("ERR: No more ports available.\n"); + UnlockObject(Connection); return STATUS_TOO_MANY_ADDRESSES; } Connection->AddressFile->Port = AllocatedPort; diff --git a/drivers/network/tcpip/ip/transport/tcp/tcp.c b/drivers/network/tcpip/ip/transport/tcp/tcp.c index cd28ffaf71a..3d65e9a46b9 100644 --- a/drivers/network/tcpip/ip/transport/tcp/tcp.c +++ b/drivers/network/tcpip/ip/transport/tcp/tcp.c @@ -386,6 +386,7 @@ NTSTATUS TCPConnect if (AllocatedPort == (UINT) -1) { DbgPrint("ERR: No more ports available.\n"); + UnlockObject(Connection); return STATUS_TOO_MANY_ADDRESSES; } Connection->AddressFile->Port = AllocatedPort;