Author: cgutman
Date: Fri Jan 15 19:01:52 2010
New Revision: 45087
URL:
http://svn.reactos.org/svn/reactos?rev=45087&view=rev
Log:
- Restore the worker in the loopback code because we can enter the loopback code from
TCPPacketSend at a raised IRQL
- Fixes a crash with TCP over loopback
Modified:
branches/aicom-network-branch/lib/drivers/ip/network/loopback.c
Modified: branches/aicom-network-branch/lib/drivers/ip/network/loopback.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/driver…
==============================================================================
--- branches/aicom-network-branch/lib/drivers/ip/network/loopback.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/lib/drivers/ip/network/loopback.c [iso-8859-1] Fri Jan
15 19:01:52 2010
@@ -11,6 +11,17 @@
#include "precomp.h"
PIP_INTERFACE Loopback = NULL;
+
+VOID LoopPassiveWorker(
+ PVOID Context)
+{
+ PIP_PACKET IPPacket = Context;
+
+ IPReceive(Loopback, IPPacket);
+ FreeNdisPacket(IPPacket->NdisPacket);
+
+ ExFreePool(Context);
+}
VOID LoopTransmit(
PVOID Context,
@@ -34,6 +45,7 @@
NDIS_STATUS NdisStatus;
IP_PACKET IPPacket;
PNDIS_BUFFER NdisBuffer;
+ PVOID WorkerBuffer;
ASSERT_KM_POINTER(NdisPacket);
ASSERT_KM_POINTER(PC(NdisPacket));
@@ -46,9 +58,6 @@
NdisStatus = AllocatePacketWithBuffer
( &XmitPacket, PacketBuffer, PacketLength );
- (PC(NdisPacket)->DLComplete)
- ( PC(NdisPacket)->Context, NdisPacket, NdisStatus );
-
if( NT_SUCCESS(NdisStatus) ) {
IPInitializePacket(&IPPacket, 0);
@@ -60,12 +69,23 @@
&IPPacket.ContigSize,
&IPPacket.TotalSize);
- IPReceive(Loopback, &IPPacket);
-
- FreeNdisPacket(XmitPacket);
+
+ WorkerBuffer = ExAllocatePool(NonPagedPool, sizeof(IPPacket));
+ if (WorkerBuffer)
+ {
+ RtlCopyMemory(WorkerBuffer, &IPPacket, sizeof(IPPacket));
+ if (!ChewCreate(LoopPassiveWorker, WorkerBuffer))
+ {
+ ExFreePool(WorkerBuffer);
+ NdisStatus = NDIS_STATUS_RESOURCES;
+ }
+ }
+ else
+ NdisStatus = NDIS_STATUS_RESOURCES;
}
- TI_DbgPrint(MAX_TRACE, ("Done\n"));
+ (PC(NdisPacket)->DLComplete)
+ ( PC(NdisPacket)->Context, NdisPacket, NdisStatus );
}
NDIS_STATUS LoopRegisterAdapter(