https://git.reactos.org/?p=reactos.git;a=commitdiff;h=10fbefdeb0425f9b1f667…
commit 10fbefdeb0425f9b1f66718237b14b6f0f889643
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Aug 14 23:33:18 2022 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Dec 1 20:17:40 2022 +0200
[NTOS] Improve MmCleanProcessAddressSpace
---
ntoskrnl/mm/ARM3/procsup.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/procsup.c b/ntoskrnl/mm/ARM3/procsup.c
index f2a93ce6fa5..7e314129eed 100644
--- a/ntoskrnl/mm/ARM3/procsup.c
+++ b/ntoskrnl/mm/ARM3/procsup.c
@@ -1270,12 +1270,17 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
PMM_AVL_TABLE VadTree;
PETHREAD Thread = PsGetCurrentThread();
- /* Only support this */
- ASSERT(Process->AddressSpaceInitialized == 2);
-
/* Remove from the session */
MiSessionRemoveProcess();
+ /* Abort early, when the address space wasn't fully initialized */
+ if (Process->AddressSpaceInitialized < 2)
+ {
+ DPRINT1("Incomplete address space for Process %p. Might leak
resources.\n",
+ Process);
+ return;
+ }
+
/* Lock the process address space from changes */
MmLockAddressSpace(&Process->Vm);
MiLockProcessWorkingSetUnsafe(Process, Thread);