Author: cgutman
Date: Sat Sep 6 16:30:09 2008
New Revision: 36006
URL:
http://svn.reactos.org/svn/reactos?rev=36006&view=rev
Log:
- Make PortsStartup return NTSTATUS so we can make sure memory allocated succeeded
- Change the callers to check the return status
Modified:
branches/aicom-network-fixes/lib/drivers/ip/network/ports.c
branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c
branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c
Modified: branches/aicom-network-fixes/lib/drivers/ip/network/ports.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] Sat Sep 6
16:30:09 2008
@@ -10,7 +10,7 @@
#include "precomp.h"
-VOID PortsStartup( PPORT_SET PortSet,
+NTSTATUS PortsStartup( PPORT_SET PortSet,
UINT StartingPort,
UINT PortsToManage ) {
PortSet->StartingPort = StartingPort;
@@ -19,11 +19,13 @@
PortSet->PortsToOversee - 1;
PortSet->ProtoBitBuffer =
PoolAllocateBuffer( (PortSet->PortsToOversee + 7) / 8 );
+ if(!PortSet->ProtoBitBuffer) return STATUS_INSUFFICIENT_RESOURCES;
RtlInitializeBitMap( &PortSet->ProtoBitmap,
PortSet->ProtoBitBuffer,
PortSet->PortsToOversee );
RtlClearAllBits( &PortSet->ProtoBitmap );
ExInitializeFastMutex( &PortSet->Mutex );
+ return STATUS_SUCCESS;
}
VOID PortsShutdown( PPORT_SET PortSet ) {
Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Sep
6 16:30:09 2008
@@ -455,7 +455,11 @@
return Status;
}
- PortsStartup( &TCPPorts, 1, 0xfffe );
+ Status = PortsStartup( &TCPPorts, 1, 0xfffe );
+ if( !NT_SUCCESS(Status) ) {
+ TCPMemShutdown();
+ return Status;
+ }
RegisterOskitTCPEventHandlers( &EventHandlers );
InitOskitTCP();
Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Sat Sep
6 16:30:09 2008
@@ -302,8 +302,12 @@
#ifdef __NTDRIVER__
RtlZeroMemory(&UDPStats, sizeof(UDP_STATISTICS));
#endif
-
- PortsStartup( &UDPPorts, 1, 0xfffe );
+
+ NTSTATUS Status;
+
+ Status = PortsStartup( &UDPPorts, 1, 0xfffe );
+
+ if( !NT_SUCCESS(Status) ) return Status;
/* Register this protocol with IP layer */
IPRegisterProtocol(IPPROTO_UDP, UDPReceive);