From 4f1dd7e361ddcb03ef99efee5910e0048e081795 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sun, 12 Nov 2006 10:01:56 +0000 Subject: [PATCH] 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. svn path=/trunk/; revision=24726 --- reactos/drivers/network/tcpip/tcpip/dispatch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/network/tcpip/tcpip/dispatch.c b/reactos/drivers/network/tcpip/tcpip/dispatch.c index 635a4aecebc..3eacc972921 100644 --- a/reactos/drivers/network/tcpip/tcpip/dispatch.c +++ b/reactos/drivers/network/tcpip/tcpip/dispatch.c @@ -796,6 +796,9 @@ NTSTATUS DispTdiReceive( 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 @@ NTSTATUS DispTdiReceive( 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));