https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2010a5b8d915beebd64c6…
commit 2010a5b8d915beebd64c68cb568b03c29ab64d75
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Mon Jul 24 22:38:27 2023 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Jul 29 11:23:13 2023 -0400
[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;