Author: cgutman
Date: Tue Aug 19 11:23:01 2008
New Revision: 35454
URL:
http://svn.reactos.org/svn/reactos?rev=35454&view=rev
Log:
- SEHify LockRequest
- Free everything and return if MmMapLockedPages fails
Modified:
branches/aicom-network-fixes/drivers/network/afd/afd/lock.c
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] Tue Aug 19
11:23:01 2008
@@ -15,6 +15,8 @@
/* Lock a method_neither request so it'll be available from DISPATCH_LEVEL */
PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) {
+ BOOLEAN LockFailed = FALSE;
+
Irp->MdlAddress =
IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer,
IrpSp->Parameters.DeviceIoControl.InputBufferLength,
@@ -22,9 +24,27 @@
FALSE,
NULL );
if( Irp->MdlAddress ) {
- MmProbeAndLockPages( Irp->MdlAddress, KernelMode, IoModifyAccess );
+ _SEH_TRY {
+ MmProbeAndLockPages( Irp->MdlAddress, KernelMode, IoModifyAccess );
+ } _SEH_HANDLE {
+ LockFailed = TRUE;
+ } _SEH_END;
+
+ if( LockFailed ) {
+ IoFreeMdl( Irp->MdlAddress );
+ Irp->MdlAddress = NULL;
+ return NULL;
+ }
+
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer =
MmMapLockedPages( Irp->MdlAddress, KernelMode );
+
+ if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer ) {
+ IoFreeMdl( Irp->MdlAddress );
+ Irp->MdlAddress = NULL;
+ return NULL;
+ }
+
return IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
} else return NULL;
}