Author: cgutman
Date: Mon Mar 23 08:05:57 2009
New Revision: 40183
URL:
http://svn.reactos.org/svn/reactos?rev=40183&view=rev
Log:
- This should fix a rare afd crash
- It was a race condition caused by another thread clearing our IRP while we were still
using it
Modified:
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/write.c
trunk/reactos/drivers/network/afd/include/afd.h
Modified: trunk/reactos/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/lo…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/lock.c [iso-8859-1] Mon Mar 23 08:05:57 2009
@@ -323,14 +323,3 @@
&Irp->Tail.Overlay.ListEntry );
return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL );
}
-
-VOID SocketCalloutEnter( PAFD_FCB FCB ) {
- ASSERT(FCB->Locked);
- FCB->Critical = TRUE;
- SocketStateUnlock( FCB );
-}
-
-VOID SocketCalloutLeave( PAFD_FCB FCB ) {
- FCB->Critical = FALSE;
- SocketAcquireStateLock( FCB );
-}
Modified: trunk/reactos/drivers/network/afd/afd/read.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Mon Mar 23 08:05:57 2009
@@ -104,8 +104,6 @@
if( !FCB->ReceiveIrp.InFlightRequest ) {
AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n"));
- SocketCalloutEnter( FCB );
-
Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest,
FCB->Connection.Object,
TDI_RECEIVE_NORMAL,
@@ -114,8 +112,6 @@
&FCB->ReceiveIrp.Iosb,
ReceiveComplete,
FCB );
-
- SocketCalloutLeave( FCB );
if( Status == STATUS_SUCCESS )
FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information;
@@ -559,9 +555,8 @@
PollReeval( FCB->DeviceExt, FCB->FileObject );
if( NT_SUCCESS(Irp->IoStatus.Status) ) {
+
/* Now relaunch the datagram request */
- SocketCalloutEnter( FCB );
-
Status = TdiReceiveDatagram
( &FCB->ReceiveIrp.InFlightRequest,
FCB->AddressFile.Object,
@@ -572,8 +567,6 @@
&FCB->ReceiveIrp.Iosb,
PacketSocketRecvComplete,
FCB );
-
- SocketCalloutLeave( FCB );
}
SocketStateUnlock( FCB );
Modified: trunk/reactos/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Mon Mar 23 08:05:57 2009
@@ -134,8 +134,6 @@
if( FCB->Send.BytesUsed ) {
FCB->PollState &= ~AFD_EVENT_SEND;
- SocketCalloutEnter( FCB );
-
Status = TdiSend( &FCB->SendIrp.InFlightRequest,
FCB->Connection.Object,
0,
@@ -144,8 +142,6 @@
&FCB->SendIrp.Iosb,
SendComplete,
FCB );
-
- SocketCalloutLeave( FCB );
} else {
FCB->PollState |= AFD_EVENT_SEND;
}
@@ -260,8 +256,6 @@
TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress );
if( TargetAddress ) {
- SocketCalloutEnter( FCB );
-
Status = TdiSendDatagram
( &FCB->SendIrp.InFlightRequest,
FCB->AddressFile.Object,
@@ -272,8 +266,6 @@
PacketSocketSendComplete,
FCB );
- SocketCalloutLeave( FCB );
-
ExFreePool( TargetAddress );
} else Status = STATUS_NO_MEMORY;
@@ -358,10 +350,6 @@
if( TotalBytesCopied > 0 ) {
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE );
- FCB->SendIrp.InFlightRequest = (PVOID)1; /* Placeholder */
-
- SocketCalloutEnter( FCB );
-
Status = TdiSend( &FCB->SendIrp.InFlightRequest,
FCB->Connection.Object,
0,
@@ -371,8 +359,6 @@
SendComplete,
FCB );
- SocketCalloutLeave( FCB );
-
if( Status == STATUS_PENDING )
Status = STATUS_SUCCESS;
@@ -434,8 +420,6 @@
/* Check the size of the Address given ... */
if( TargetAddress ) {
- SocketCalloutEnter( FCB );
-
Status = TdiSendDatagram
( &FCB->SendIrp.InFlightRequest,
FCB->AddressFile.Object,
@@ -446,8 +430,6 @@
PacketSocketSendComplete,
FCB );
- SocketCalloutLeave( FCB );
-
ExFreePool( TargetAddress );
} else Status = STATUS_NO_MEMORY;
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Mar 23 08:05:57 2009
@@ -271,8 +271,6 @@
VOID UnlockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp );
VOID UnlockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp );
-VOID SocketCalloutEnter( PAFD_FCB FCB );
-VOID SocketCalloutLeave( PAFD_FCB FCB );
/* main.c */