[ros-diffs] [arty] 24726: Broaden a lock to prevent a race for completion of the receive IRP. Fixes some crashes while receiving from a fast remote host under load.

arty at svn.reactos.org arty at svn.reactos.org
Sun Nov 12 11:01:57 CET 2006


Author: arty
Date: Sun Nov 12 13:01:56 2006
New Revision: 24726

URL: http://svn.reactos.org/svn/reactos?rev=24726&view=rev
Log:
Broaden a lock to prevent a race for completion of the receive IRP.  Fixes
some crashes while receiving from a fast remote host under load.

Modified:
    trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c

Modified: trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c?rev=24726&r1=24725&r2=24726&view=diff
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/dispatch.c Sun Nov 12 13:01:56 2006
@@ -796,6 +796,9 @@
   TI_DbgPrint(MID_TRACE,("TCPIP<<< Got an MDL: %x\n", Irp->MdlAddress));
   if (NT_SUCCESS(Status))
     {
+      /* Lock here so we're sure we've got the following 'mark pending' */
+      TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+
       Status = TCPReceiveData(
 	  TranContext->Handle.ConnectionContext,
 	  (PNDIS_BUFFER)Irp->MdlAddress,
@@ -807,8 +810,11 @@
       if (Status != STATUS_PENDING)
       {
           DispDataRequestComplete(Irp, Status, BytesReceived);
-      } else
+      } else {
 	  IoMarkIrpPending(Irp);
+      }
+
+      TcpipRecursiveMutexLeave( &TCPLock );
     }
 
   TI_DbgPrint(DEBUG_IRP, ("Leaving. Status is (0x%X)\n", Status));




More information about the Ros-diffs mailing list