Author: sir_richard
Date: Sun Mar  4 02:56:16 2012
New Revision: 55985

URL: http://svn.reactos.org/svn/reactos?rev=55985&view=rev
Log:
[NTOS]: Don't keep the address space locked when failing in 
NtFreeVirtualMemory. Dang this testbot is good at catching those bugs.

Modified:
    trunk/reactos/ntoskrnl/mm/ARM3/virtual.c

Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c?rev=55985&r1=55984&r2=55985&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sun Mar  4 02:56:16 
2012
@@ -1825,7 +1825,6 @@
     //
     if (PteCount) MiProcessValidPteList(ValidPteList, PteCount);
     MiUnlockWorkingSet(CurrentThread, &Process->Vm);
-    if (CommitReduction) DPRINT1("DBG-REDUCE: %lx\n", CommitReduction);
     return CommitReduction;
 }
 
@@ -3870,7 +3869,7 @@
             //
             // Finally lock the working set and remove the VAD from the VAD 
tree
             //
-            MiLockWorkingSet(CurrentThread, &Process->Vm);
+            MiLockWorkingSet(CurrentThread, AddressSpace);
             ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
             MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
         }
@@ -3900,7 +3899,7 @@
                     // the code path above when the caller sets a zero region 
size
                     // and the whole VAD is destroyed
                     //
-                    MiLockWorkingSet(CurrentThread, &Process->Vm);
+                    MiLockWorkingSet(CurrentThread, AddressSpace);
                     ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
                     MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
                 }
@@ -3972,7 +3971,7 @@
         // around with process pages.
         //
         MiDeleteVirtualAddresses(StartingAddress, EndingAddress, NULL);
-        MiUnlockWorkingSet(CurrentThread, &Process->Vm);
+        MiUnlockWorkingSet(CurrentThread, AddressSpace);
         Status = STATUS_SUCCESS;
 
 FinalPath:
@@ -4069,6 +4068,7 @@
     // return whatever failure code was sent.
     //
 FailPath:
+    MiUnlockWorkingSet(CurrentThread, AddressSpace);
     if (Attached) KeUnstackDetachProcess(&ApcState);
     if (ProcessHandle != NtCurrentProcess()) ObDereferenceObject(Process);
     return Status;


Reply via email to