Author: cgutman
Date: Sat Mar 28 01:32:28 2009
New Revision: 40262
URL:
http://svn.reactos.org/svn/reactos?rev=40262&view=rev
Log:
- Fix some issues with LockBuffers
- We must lock buffers before using them
Modified:
trunk/reactos/drivers/network/afd/afd/lock.c
trunk/reactos/drivers/network/afd/afd/write.c
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] Sat Mar 28 01:32:28 2009
@@ -72,7 +72,6 @@
UINT Lock = (LockAddress && AddressLen) ? 2 : 0;
UINT Size = sizeof(AFD_WSABUF) * (Count + Lock);
PAFD_WSABUF NewBuf = ExAllocatePool( PagedPool, Size * 2 );
- PMDL NewMdl;
BOOLEAN LockFailed = FALSE;
AFD_DbgPrint(MID_TRACE,("Called(%08x)\n", NewBuf));
@@ -82,7 +81,7 @@
_SEH2_TRY {
RtlCopyMemory( NewBuf, Buf, sizeof(AFD_WSABUF) * Count );
- if( LockAddress ) {
+ if( Lock != 0 ) {
NewBuf[Count].buf = AddressBuf;
NewBuf[Count].len = *AddressLen;
Count++;
@@ -102,20 +101,18 @@
AFD_DbgPrint(MID_TRACE,("Locking buffer %d (%x:%d)\n",
i, NewBuf[i].buf, NewBuf[i].len));
- if( NewBuf[i].len ) {
- NewMdl = IoAllocateMdl( NewBuf[i].buf,
- NewBuf[i].len,
- FALSE,
- FALSE,
- NULL );
+ if( NewBuf[i].buf && NewBuf[i].len ) {
+ MapBuf[i].Mdl = IoAllocateMdl( NewBuf[i].buf,
+ NewBuf[i].len,
+ FALSE,
+ FALSE,
+ NULL );
} else {
MapBuf[i].Mdl = NULL;
continue;
}
- AFD_DbgPrint(MID_TRACE,("NewMdl @ %x\n", NewMdl));
-
- MapBuf[i].Mdl = NewMdl;
+ AFD_DbgPrint(MID_TRACE,("NewMdl @ %x\n", MapBuf[i].Mdl));
if( MapBuf[i].Mdl ) {
AFD_DbgPrint(MID_TRACE,("Probe and lock pages\n"));
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] Sat Mar 28 01:32:28 2009
@@ -391,6 +391,15 @@
return UnlockAndMaybeComplete
( FCB, STATUS_NO_MEMORY, Irp, 0, NULL );
+ SendReq->BufferArray = LockBuffers( SendReq->BufferArray,
+ SendReq->BufferCount,
+ NULL, NULL,
+ FALSE, FALSE );
+
+ if( !SendReq->BufferArray )
+ return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION,
+ Irp, 0, NULL );
+
AFD_DbgPrint
(MID_TRACE,("RemoteAddress #%d Type %d\n",
((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->