Author: cgutman
Date: Fri Jan 8 19:10:05 2010
New Revision: 45004
URL:
http://svn.reactos.org/svn/reactos?rev=45004&view=rev
Log:
- Add locking to ICMPSendDatagram
Modified:
branches/aicom-network-branch/lib/drivers/ip/network/icmp.c
Modified: branches/aicom-network-branch/lib/drivers/ip/network/icmp.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/driver…
==============================================================================
--- branches/aicom-network-branch/lib/drivers/ip/network/icmp.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/lib/drivers/ip/network/icmp.c [iso-8859-1] Fri Jan 8
19:10:05 2010
@@ -159,6 +159,7 @@
USHORT RemotePort;
NTSTATUS Status;
PNEIGHBOR_CACHE_ENTRY NCE;
+ KIRQL OldIrql;
TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n",
AddrFile, ConnInfo, BufferData, DataSize));
@@ -177,6 +178,8 @@
}
TI_DbgPrint(MID_TRACE,("About to get route to destination\n"));
+
+ LockObject(AddrFile, &OldIrql);
LocalAddress = AddrFile->Address;
if (AddrIsUnspecified(&LocalAddress))
@@ -186,14 +189,20 @@
* interface we're sending over
*/
if(!(NCE = RouteGetRouteToDestination( &RemoteAddress )))
+ {
+ UnlockObject(AddrFile, OldIrql);
return STATUS_NETWORK_UNREACHABLE;
+ }
LocalAddress = NCE->Interface->Unicast;
}
else
{
if(!(NCE = NBLocateNeighbor( &LocalAddress )))
+ {
+ UnlockObject(AddrFile, OldIrql);
return STATUS_INVALID_PARAMETER;
+ }
}
Status = PrepareICMPPacket( NCE->Interface,
@@ -203,17 +212,23 @@
DataSize );
if( !NT_SUCCESS(Status) )
+ {
+ UnlockObject(AddrFile, OldIrql);
return Status;
+ }
TI_DbgPrint(MID_TRACE,("About to send datagram\n"));
if (!NT_SUCCESS(Status = IPSendDatagram( &Packet, NCE, ICMPSendPacketComplete,
NULL )))
{
+ UnlockObject(AddrFile, OldIrql);
FreeNdisPacket(Packet.NdisPacket);
return Status;
}
TI_DbgPrint(MID_TRACE,("Leaving\n"));
+
+ UnlockObject(AddrFile, OldIrql);
return STATUS_SUCCESS;
}