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

commit 5f014e421b8944cae3127ac124b1097d4bd49b61
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun Apr 9 23:12:14 2023 +0300
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Jul 29 14:00:44 2023 +0300

    [NTOS:Mm] Handle RosMm pages in MiDecrementReferenceCount
    
    This is required, when RosMm unmaps locked pages and they later get 
unlocked.
---
 ntoskrnl/mm/ARM3/pfnlist.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ntoskrnl/mm/ARM3/pfnlist.c b/ntoskrnl/mm/ARM3/pfnlist.c
index 5712f22557a..56654d1e113 100644
--- a/ntoskrnl/mm/ARM3/pfnlist.c
+++ b/ntoskrnl/mm/ARM3/pfnlist.c
@@ -1219,6 +1219,10 @@ MiDecrementShareCount(IN PMMPFN Pfn1,
     }
 }
 
+VOID
+NTAPI
+MmDereferencePage(PFN_NUMBER Pfn);
+
 VOID
 NTAPI
 MiDecrementReferenceCount(IN PMMPFN Pfn1,
@@ -1227,6 +1231,13 @@ MiDecrementReferenceCount(IN PMMPFN Pfn1,
     /* PFN lock must be held */
     MI_ASSERT_PFN_LOCK_HELD();
 
+    /* Handle RosMm PFNs here, too (in case they got locked/unlocked by ARM3) 
*/
+    if (MI_IS_ROS_PFN(Pfn1))
+    {
+        MmDereferencePage(PageFrameIndex);
+        return;
+    }
+
     /* Sanity checks on the page */
     if (PageFrameIndex > MmHighestPhysicalPage ||
         Pfn1 != MI_PFN_ELEMENT(PageFrameIndex) ||

Reply via email to