https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e46f1a9af37ffd0fd9a99293c66f23acb0990856

commit e46f1a9af37ffd0fd9a99293c66f23acb0990856
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Mon Jan 4 18:26:18 2021 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Feb 3 09:41:23 2021 +0100

    [NTOS:MM] Disable APC while performing Paged Read
---
 ntoskrnl/mm/section.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 1c7fbdbefc6..b30462094c7 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -1187,6 +1187,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
     PMDL Mdl = (PMDL)MdlBase;
     PFILE_OBJECT FileObject = MemoryArea->SectionData.Segment->FileObject;
     LARGE_INTEGER FileOffset;
+    KIRQL OldIrql;
 
     FileOffset.QuadPart = MemoryArea->SectionData.Segment->Image.FileOffset + 
SegOffset;
 
@@ -1203,6 +1204,9 @@ MiReadPage(PMEMORY_AREA MemoryArea,
 
     KeInitializeEvent(&Event, NotificationEvent, FALSE);
 
+    /* Disable APCs */
+    KeRaiseIrql(APC_LEVEL, &OldIrql);
+
     Status = IoPageRead(FileObject, Mdl, &FileOffset, &Event, &IoStatus);
     if (Status == STATUS_PENDING)
     {
@@ -1215,6 +1219,8 @@ MiReadPage(PMEMORY_AREA MemoryArea,
         MmUnmapLockedPages (Mdl->MappedSystemVa, Mdl);
     }
 
+    KeLowerIrql(OldIrql);
+
     if (Status == STATUS_END_OF_FILE)
     {
         DPRINT1("Got STATUS_END_OF_FILE at offset %I64d for file %wZ.\n", 
SegOffset, &FileObject->FileName);

Reply via email to