Author: cgutman
Date: Fri Aug 1 07:19:18 2008
New Revision: 35001
URL:
http://svn.reactos.org/svn/reactos?rev=35001&view=rev
Log:
* Fix many memory leaks by unmapping MDL pages when UnlockAndMaybeComplete and LostSocket
are called with Status != STATUS_PENDING
This change should probably be merged to trunk before 0.3.6
Modified:
branches/aicom-network-fixes/drivers/network/afd/afd/bind.c
branches/aicom-network-fixes/drivers/network/afd/afd/connect.c
branches/aicom-network-fixes/drivers/network/afd/afd/context.c
branches/aicom-network-fixes/drivers/network/afd/afd/info.c
branches/aicom-network-fixes/drivers/network/afd/afd/listen.c
branches/aicom-network-fixes/drivers/network/afd/afd/lock.c
branches/aicom-network-fixes/drivers/network/afd/afd/main.c
branches/aicom-network-fixes/drivers/network/afd/afd/read.c
branches/aicom-network-fixes/drivers/network/afd/afd/select.c
branches/aicom-network-fixes/drivers/network/afd/afd/write.c
branches/aicom-network-fixes/drivers/network/afd/include/afd.h
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/bind.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -48,10 +48,10 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(BindReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
FCB->LocalAddress = TaCopyTransportAddress( &BindReq->Address );
@@ -61,7 +61,7 @@
if( NT_SUCCESS(Status) )
FCB->State = SOCKET_STATE_BOUND;
- else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ else return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags));
@@ -87,6 +87,6 @@
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
}
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/connect.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/connect.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -71,7 +71,7 @@
/* I was wrong about this before as we can have pending writes to a not
* yet connected socket */
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n",
Irp->IoStatus.Status));
@@ -137,10 +137,10 @@
PAFD_CONNECT_INFO ConnectReq;
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(ConnectReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
AFD_DbgPrint(MID_TRACE,("Connect request:\n"));
#if 0
@@ -177,11 +177,10 @@
if( NT_SUCCESS(Status) )
FCB->State = SOCKET_STATE_BOUND;
else
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL,
- TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
} else
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
} /* Drop through to SOCKET_STATE_BOUND */
case SOCKET_STATE_BOUND:
@@ -228,5 +227,5 @@
break;
}
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
-}
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
+}
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/context.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/context.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/context.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -20,7 +20,7 @@
PAFD_FCB FCB = FileObject->FsContext;
UINT ContextSize = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->ContextSize < ContextSize ) ContextSize = FCB->ContextSize;
@@ -33,7 +33,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS STDCALL
@@ -43,7 +43,7 @@
PFILE_OBJECT FileObject = IrpSp->FileObject;
PAFD_FCB FCB = FileObject->FsContext;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->ContextSize <
IrpSp->Parameters.DeviceIoControl.InputBufferLength ) {
@@ -64,5 +64,5 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/info.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/info.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -26,7 +26,7 @@
_SEH_TRY {
if( !SocketAcquireStateLock( FCB ) ) {
- Status = LostSocket( Irp, FALSE );
+ Status = LostSocket( Irp );
_SEH_YIELD(return Status);
}
@@ -69,7 +69,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS STDCALL
@@ -84,11 +84,11 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->AddressFile.Object == NULL) {
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0,
- NULL, FALSE );
+ NULL );
}
Mdl = IoAllocateMdl
@@ -159,5 +159,5 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/listen.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -157,16 +157,16 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(ListenReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
if( FCB->State != SOCKET_STATE_BOUND ) {
Status = STATUS_UNSUCCESSFUL;
AFD_DbgPrint(MID_TRACE,("Could not listen an unbound socket\n"));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
FCB->DelayedAccept = ListenReq->UseDelayedAcceptance;
@@ -198,7 +198,7 @@
Status = STATUS_SUCCESS;
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
NTSTATUS AfdWaitForListen( PDEVICE_OBJECT DeviceObject, PIRP Irp,
@@ -209,7 +209,7 @@
AFD_DbgPrint(MID_TRACE,("Called\n"));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
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, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_ACCEPT;
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/lock.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/lock.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/lock.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -235,8 +235,7 @@
NTSTATUS NTAPI UnlockAndMaybeComplete
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
UINT Information,
- PIO_COMPLETION_ROUTINE Completion,
- BOOL ShouldUnlock ) {
+ PIO_COMPLETION_ROUTINE Completion ) {
if( Status == STATUS_PENDING ) {
/* We should firstly mark this IRP as pending, because
@@ -244,29 +243,25 @@
before we return from SocketStateUnlock(). */
IoMarkIrpPending( Irp );
SocketStateUnlock( FCB );
- if( ShouldUnlock )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
} else {
+ if ( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
SocketStateUnlock( FCB );
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = Information;
if( Completion )
Completion( FCB->DeviceExt->DeviceObject, Irp, FCB );
- if( ShouldUnlock )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
IoCompleteRequest( Irp, IO_NETWORK_INCREMENT );
}
return Status;
}
-NTSTATUS LostSocket( PIRP Irp, BOOL ShouldUnlockIrp ) {
+NTSTATUS LostSocket( PIRP Irp ) {
NTSTATUS Status = STATUS_INVALID_PARAMETER;
AFD_DbgPrint(MIN_TRACE,("Called.\n"));
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = Status;
- if( ShouldUnlockIrp )
- UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
+ if ( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) );
IoCompleteRequest( Irp, IO_NO_INCREMENT );
return Status;
}
@@ -274,7 +269,7 @@
NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) {
InsertTailList( &FCB->PendingIrpList[Function],
&Irp->Tail.Overlay.ListEntry );
- return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL, FALSE );
+ return UnlockAndMaybeComplete( FCB, STATUS_PENDING, Irp, 0, NULL );
}
VOID SocketCalloutEnter( PAFD_FCB FCB ) {
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/main.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -257,11 +257,11 @@
NTSTATUS Status;
USHORT Flags = 0;
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( !(DisReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
if (NULL == FCB->RemoteAddress)
{
@@ -274,7 +274,7 @@
if( !NT_SUCCESS(Status) || !ConnInfo )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, TRUE );
+ Irp, 0, NULL );
}
if( DisReq->DisconnectType & AFD_DISCONNECT_SEND )
@@ -294,7 +294,7 @@
if (ConnInfo) ExFreePool( ConnInfo );
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
}
static NTSTATUS STDCALL
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/read.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/read.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -273,21 +273,21 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
if( FCB->State != SOCKET_STATE_CONNECTED &&
FCB->State != SOCKET_STATE_CONNECTING ) {
AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n",
FCB->State));
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
}
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS )
{
AFD_DbgPrint(MID_TRACE,("Receive on connection-less sockets not
implemented\n"));
return UnlockAndMaybeComplete( FCB, STATUS_NOT_IMPLEMENTED,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
}
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
@@ -295,7 +295,7 @@
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY,
- Irp, 0, NULL, FALSE );
+ Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
@@ -306,7 +306,7 @@
if( !RecvReq->BufferArray ) {
return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
- Irp, 0, NULL, TRUE );
+ Irp, 0, NULL );
}
Irp->IoStatus.Status = STATUS_PENDING;
@@ -326,7 +326,7 @@
RemoveEntryList( &Irp->Tail.Overlay.ListEntry );
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE );
return UnlockAndMaybeComplete( FCB, Status, Irp,
- TotalBytesCopied, NULL, TRUE );
+ TotalBytesCopied, NULL );
} else if( Status == STATUS_PENDING ) {
AFD_DbgPrint(MID_TRACE,("Leaving read irp\n"));
IoMarkIrpPending( Irp );
@@ -501,6 +501,7 @@
Status = NextIrp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
NextIrp->IoStatus.Information = DatagramRecv->Len;
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
} else {
AFD_DbgPrint(MID_TRACE,("Satisfying\n"));
@@ -509,6 +510,7 @@
(PUINT)&NextIrp->IoStatus.Information );
AFD_DbgPrint(MID_TRACE,("Unlocking\n"));
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
AFD_DbgPrint(MID_TRACE,("Completing\n"));
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
@@ -557,17 +559,17 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_RECEIVE;
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
if( !(RecvReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags));
@@ -579,7 +581,7 @@
if( !RecvReq->BufferArray ) { /* access violation in userspace */
return UnlockAndMaybeComplete
- ( FCB, STATUS_ACCESS_VIOLATION, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_ACCESS_VIOLATION, Irp, 0, NULL );
}
if( !IsListEmpty( &FCB->DatagramList ) ) {
@@ -601,7 +603,7 @@
PollReeval( FCB->DeviceExt, FCB->FileObject );
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, RecvReq->BufferArray[0].len, NULL, TRUE );
+ ( FCB, Status, Irp, RecvReq->BufferArray[0].len, NULL );
} else {
Status = SatisfyPacketRecvRequest
( FCB, Irp, DatagramRecv,
@@ -615,13 +617,13 @@
PollReeval( FCB->DeviceExt, FCB->FileObject );
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, Irp->IoStatus.Information, NULL, TRUE );
+ ( FCB, Status, Irp, Irp->IoStatus.Information, NULL );
}
} else if( RecvReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
Status = STATUS_CANT_WAIT;
PollReeval( FCB->DeviceExt, FCB->FileObject );
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL, TRUE );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, 0, NULL );
} else {
PollReeval( FCB->DeviceExt, FCB->FileObject );
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV );
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/select.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/select.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -276,14 +276,14 @@
if ( !EventSelectInfo ) {
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
}
AFD_DbgPrint(MID_TRACE,("Called (Event %x Triggers %x)\n",
EventSelectInfo->EventObject,
EventSelectInfo->Events));
if( !SocketAcquireStateLock( FCB ) ) {
- return LostSocket( Irp, TRUE );
+ return LostSocket( Irp );
}
FCB->EventSelectTriggers = FCB->EventsFired = 0;
@@ -309,7 +309,7 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
- 0, NULL, TRUE );
+ 0, NULL );
}
NTSTATUS STDCALL
@@ -324,18 +324,18 @@
if ( !EnumReq ) {
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
}
if( !SocketAcquireStateLock( FCB ) ) {
- return LostSocket( Irp, TRUE );
+ return LostSocket( Irp );
}
EnumReq->PollEvents = FCB->PollState;
RtlZeroMemory( EnumReq->EventStatus, sizeof(EnumReq->EventStatus) );
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
- 0, NULL, TRUE );
+ 0, NULL );
}
/* * * NOTE ALWAYS CALLED AT DISPATCH_LEVEL * * */
Modified: branches/aicom-network-fixes/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/afd/afd/write.c [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -74,6 +74,8 @@
NextIrp->IoStatus.Status = Status;
NextIrp->IoStatus.Information = 0;
+ if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation(
NextIrp ) );
+
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
}
@@ -151,7 +153,7 @@
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
return UnlockAndMaybeComplete( FCB, Status, NextIrp, TotalBytesCopied,
- NULL, TRUE );
+ NULL );
} else if( NextIrp ) {
AFD_DbgPrint(MID_TRACE,("Could not do any more with Irp %x\n",
NextIrp));
@@ -211,7 +213,7 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_SEND;
@@ -223,11 +225,11 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp,
- 0, NULL, FALSE );
+ 0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0,
- NULL, FALSE );
+ NULL );
/* Must lock buffers before handing off user data */
SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
@@ -259,12 +261,12 @@
return UnlockAndMaybeComplete( FCB, Status, Irp,
SendReq->BufferArray[0].len,
- NULL, TRUE );
+ NULL );
}
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, TotalBytesCopied, NULL );
AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State));
@@ -272,7 +274,7 @@
if( SendReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
return UnlockAndMaybeComplete
- ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
} else {
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
@@ -323,7 +325,7 @@
AFD_DbgPrint(MID_TRACE,("Empty send\n"));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, TotalBytesCopied, NULL, TRUE );
+ ( FCB, Status, Irp, TotalBytesCopied, NULL );
}
AFD_DbgPrint(MID_TRACE,("Completed %d bytes\n", TotalBytesCopied));
@@ -353,14 +355,14 @@
Status, TotalBytesCopied));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, TotalBytesCopied, NULL, TRUE );
+ ( FCB, Status, Irp, TotalBytesCopied, NULL );
}
}
if( SendReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
return UnlockAndMaybeComplete
- ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL, TRUE );
+ ( FCB, STATUS_CANT_WAIT, Irp, 0, NULL );
} else {
AFD_DbgPrint(MID_TRACE,("Queuing request\n"));
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND );
@@ -378,7 +380,7 @@
AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB));
- if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE );
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
FCB->EventsFired &= ~AFD_EVENT_SEND;
FCB->PollState &= ~AFD_EVENT_SEND;
@@ -386,10 +388,10 @@
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
- ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_UNSUCCESSFUL, Irp, 0, NULL );
if( !(SendReq = LockRequest( Irp, IrpSp )) )
return UnlockAndMaybeComplete
- ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL, FALSE );
+ ( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
AFD_DbgPrint
(MID_TRACE,("RemoteAddress #%d Type %d\n",
@@ -426,6 +428,6 @@
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status));
return UnlockAndMaybeComplete
- ( FCB, Status, Irp, SendReq->BufferArray[0].len, NULL, TRUE );
+ ( FCB, Status, Irp, SendReq->BufferArray[0].len, NULL );
}
Modified: branches/aicom-network-fixes/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/afd/include/afd.h [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/afd/include/afd.h [iso-8859-1] Fri Aug 1
07:19:18 2008
@@ -206,10 +206,9 @@
NTSTATUS NTAPI UnlockAndMaybeComplete
( PAFD_FCB FCB, NTSTATUS Status, PIRP Irp,
UINT Information,
- PIO_COMPLETION_ROUTINE Completion,
- BOOL ShouldUnlockIrp );
+ PIO_COMPLETION_ROUTINE Completion );
VOID SocketStateUnlock( PAFD_FCB FCB );
-NTSTATUS LostSocket( PIRP Irp, BOOL ShouldUnlockIrp );
+NTSTATUS LostSocket( PIRP Irp );
PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
VOID UnlockHandles( PAFD_HANDLE HandleArray, UINT HandleCount );
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp );