Author: arty
Date: Thu Jul 17 14:42:26 2008
New Revision: 34567
URL:
http://svn.reactos.org/svn/reactos?rev=34567&view=rev
Log:
Patch by Cameron Gutman (aicommander <at> gmail <dot> com)
- Don't mess with cancelled IRPs
- Don't attempt to cancel an already cancelled IRP
- Unmap MDL when then IRP gets completed
Modified:
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/write.c
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Thu Jul 17 14:42:26 2008
@@ -82,6 +82,7 @@
if ( Irp->Cancel ) {
/* FIXME: is this anything else we need to do? */
+ FCB->ListenIrp.InFlightRequest = NULL;
return STATUS_SUCCESS;
}
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] Thu Jul 17 14:42:26 2008
@@ -243,7 +243,9 @@
otherwise it may be completed by StreamSocketConnectComplete()
before we return from SocketStateUnlock(). */
IoMarkIrpPending( Irp );
- SocketStateUnlock( FCB );
+ SocketStateUnlock( FCB );
+ if( ShouldUnlock )
+ UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
} else {
SocketStateUnlock( FCB );
Irp->IoStatus.Status = Status;
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] Thu Jul 17 14:42:26 2008
@@ -154,6 +154,7 @@
FCB->Overread ? STATUS_END_OF_FILE : STATUS_SUCCESS;
NextIrp->IoStatus.Information = 0;
if( NextIrp == Irp ) RetStatus = Status;
+ UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
FCB->Overread = TRUE;
//FCB->PollState |= AFD_EVENT_DISCONNECT;
@@ -197,6 +198,7 @@
NextIrp->IoStatus.Status = Status;
NextIrp->IoStatus.Information = TotalBytesCopied;
if( NextIrp == Irp ) RetStatus = Status;
+ UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
}
@@ -224,6 +226,11 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
ASSERT_IRQL(APC_LEVEL);
+
+ if (Irp->Cancel) {
+ FCB->ReceiveIrp.InFlightRequest = NULL;
+ return STATUS_SUCCESS;
+ }
if( !SocketAcquireStateLock( FCB ) ) return Status;
@@ -299,7 +306,7 @@
if( !RecvReq->BufferArray ) {
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL, TRUE );
}
Irp->IoStatus.Status = STATUS_PENDING;
@@ -440,6 +447,11 @@
UINT DGSize = Irp->IoStatus.Information + sizeof( AFD_STORED_DATAGRAM );
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
+
+ if (Irp->Cancel) {
+ FCB->ReceiveIrp.InFlightRequest = NULL;
+ return STATUS_SUCCESS;
+ }
if( !SocketAcquireStateLock( FCB ) ) return STATUS_UNSUCCESSFUL;
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] Thu Jul 17 14:42:26 2008
@@ -40,6 +40,11 @@
ASSERT_IRQL(APC_LEVEL);
+ if (Irp->Cancel) {
+ FCB->ReceiveIrp.InFlightRequest = NULL;
+ return STATUS_SUCCESS;
+ }
+
if( !SocketAcquireStateLock( FCB ) ) return Status;
FCB->SendIrp.InFlightRequest = NULL;
@@ -169,6 +174,11 @@
Irp->IoStatus.Status,
Irp->IoStatus.Information));
+ if (Irp->Cancel) {
+ FCB->ReceiveIrp.InFlightRequest = NULL;
+ return STATUS_SUCCESS;
+ }
+
/* It's ok if the FCB already died */
if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS;