Author: fireball
Date: Wed Jan 30 16:33:16 2008
New Revision: 32054
URL:
http://svn.reactos.org/svn/reactos?rev=32054&view=rev
Log:
- Wrap MmProbeAndLockPages invocations into SEH.
See issue #2121 for more details.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c Wed Jan 30 16:33:16 2008
@@ -1555,9 +1555,20 @@
}
else if (DeviceObject->Flags & DO_DIRECT_IO)
{
- /* Allocate an MDL */
- Mdl = IoAllocateMdl(FileInformation, Length, FALSE, TRUE, Irp);
- MmProbeAndLockPages(Mdl, PreviousMode, IoWriteAccess);
+ _SEH_TRY
+ {
+ /* Allocate an MDL */
+ Mdl = IoAllocateMdl(FileInformation, Length, FALSE, TRUE, Irp);
+ MmProbeAndLockPages(Mdl, PreviousMode, IoWriteAccess);
+ }
+ _SEH_HANDLE
+ {
+ /* Allocating failed, clean up */
+ IopCleanupAfterException(FileObject, Irp, Event, NULL);
+ Status = _SEH_GetExceptionCode();
+ _SEH_YIELD(return Status);
+ }
+ _SEH_END;
}
else
{
@@ -2119,9 +2130,21 @@
/* Check if we have a buffer length */
if (Length)
{
- /* Allocate an MDL */
- Mdl = IoAllocateMdl(Buffer, Length, FALSE, TRUE, Irp);
- MmProbeAndLockPages(Mdl, PreviousMode, IoWriteAccess);
+ _SEH_TRY
+ {
+ /* Allocate an MDL */
+ Mdl = IoAllocateMdl(Buffer, Length, FALSE, TRUE, Irp);
+ MmProbeAndLockPages(Mdl, PreviousMode, IoWriteAccess);
+ }
+ _SEH_HANDLE
+ {
+ /* Allocating failed, clean up */
+ IopCleanupAfterException(FileObject, Irp, Event, NULL);
+ Status = _SEH_GetExceptionCode();
+ _SEH_YIELD(return Status);
+ }
+ _SEH_END;
+
}
/* No allocation flags */
@@ -2950,6 +2973,7 @@
/* Allocating failed, clean up */
IopCleanupAfterException(FileObject, Irp, Event, NULL);
Status = _SEH_GetExceptionCode();
+ _SEH_YIELD(return Status);
}
_SEH_END;
@@ -2967,9 +2991,20 @@
/* Check if we have a buffer length */
if (Length)
{
- /* Allocate an MDL */
- Mdl = IoAllocateMdl(Buffer, Length, FALSE, TRUE, Irp);
- MmProbeAndLockPages(Mdl, PreviousMode, IoReadAccess);
+ _SEH_TRY
+ {
+ /* Allocate an MDL */
+ Mdl = IoAllocateMdl(Buffer, Length, FALSE, TRUE, Irp);
+ MmProbeAndLockPages(Mdl, PreviousMode, IoReadAccess);
+ }
+ _SEH_HANDLE
+ {
+ /* Allocating failed, clean up */
+ IopCleanupAfterException(FileObject, Irp, Event, NULL);
+ Status = _SEH_GetExceptionCode();
+ _SEH_YIELD(return Status);
+ }
+ _SEH_END;
}
/* No allocation flags */