Author: arty
Date: Sat Jul 19 23:33:53 2008
New Revision: 34600
URL:
http://svn.reactos.org/svn/reactos?rev=34600&view=rev
Log:
Patch by Cameron Gutman (aicommander <at> gmail <dot> com)
- Fixes some issues with releasing locks
- Verify that we have an MDL before trying to unlock it
Modified:
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/context.c
trunk/reactos/drivers/network/afd/afd/info.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/select.c
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Sat Jul 19 23:33:53 2008
@@ -140,7 +140,7 @@
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
if( !(ConnectReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, TRUE );
+ 0, NULL, FALSE );
AFD_DbgPrint(MID_TRACE,("Connect request:\n"));
#if 0
Modified: trunk/reactos/drivers/network/afd/afd/context.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] Sat Jul 19 23:33:53 2008
@@ -20,7 +20,7 @@
PAFD_FCB FCB = FileObject->FsContext;
UINT ContextSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, TRUE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
if( FCB->ContextSize < ContextSize ) ContextSize = FCB->ContextSize;
@@ -43,7 +43,7 @@
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, TRUE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
if( FCB->ContextSize <
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
Modified: trunk/reactos/drivers/network/afd/afd/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Sat Jul 19 23:33:53 2008
@@ -26,7 +26,7 @@
_SEH_TRY {
if( !SocketAcquireStateLock( FCB ) ) {
- Status = LostSocket( Irp, TRUE );
+ Status = LostSocket( Irp, FALSE );
_SEH_YIELD(return Status);
}
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] Sat Jul 19 23:33:53 2008
@@ -157,7 +157,7 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, TRUE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
if( !(ListenReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
@@ -209,7 +209,7 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, TRUE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
if( !IsListEmpty( &FCB->PendingConnections ) ) {
PLIST_ENTRY PendingConn = FCB->PendingConnections.Flink;
@@ -246,7 +246,7 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, TRUE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
FCB->EventsFired &= ~AFD_EVENT_ACCEPT;
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] Sat Jul 19 23:33:53 2008
@@ -154,7 +154,7 @@
FCB->Overread ? STATUS_END_OF_FILE : STATUS_SUCCESS;
NextIrp->IoStatus.Information = 0;
if( NextIrp == Irp ) RetStatus = Status;
- UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
+ if( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
FCB->Overread = TRUE;
//FCB->PollState |= AFD_EVENT_DISCONNECT;
@@ -198,7 +198,7 @@
NextIrp->IoStatus.Status = Status;
NextIrp->IoStatus.Information = TotalBytesCopied;
if( NextIrp == Irp ) RetStatus = Status;
- UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) );
+ if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation(
NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
}
Modified: trunk/reactos/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/se…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] Sat Jul 19 23:33:53 2008
@@ -274,13 +274,17 @@
(PAFD_EVENT_SELECT_INFO)LockRequest( Irp, IrpSp );
PAFD_FCB FCB = FileObject->FsContext;
+ if ( !EventSelectInfo ) {
+ return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
+ 0, NULL, FALSE );
+ }
AFD_DbgPrint(MID_TRACE,("Called (Event %x Triggers %x)\n",
EventSelectInfo->EventObject,
EventSelectInfo->Events));
if( !SocketAcquireStateLock( FCB ) ) {
UnlockRequest( Irp, IrpSp );
- return LostSocket( Irp, FALSE );
+ return LostSocket( Irp, TRUE );
}
FCB->EventSelectTriggers = FCB->EventsFired = 0;
@@ -319,9 +323,14 @@
AFD_DbgPrint(MID_TRACE,("Called (FCB %x)\n", FCB));
+ if ( !EnumReq ) {
+ return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
+ 0, NULL, FALSE );
+ }
+
if( !SocketAcquireStateLock( FCB ) ) {
UnlockRequest( Irp, IrpSp );
- return LostSocket( Irp, FALSE );
+ return LostSocket( Irp, TRUE );
}
EnumReq->PollEvents = FCB->PollState;