[NTOS:MM] Check that we don't add rmap for NULL process

This commit is contained in:
Jérôme Gardou 2020-12-29 19:50:59 +01:00
parent caf89b9582
commit 11eee4eeec

View file

@ -410,12 +410,7 @@ MmInsertRmap(PFN_NUMBER Page, PEPROCESS Process,
if (!RMAP_IS_SEGMENT(Address)) if (!RMAP_IS_SEGMENT(Address))
{ {
if (Process == NULL) ASSERT(Process != NULL);
{
Process = PsInitialSystemProcess;
}
if (Process)
{
PrevSize = InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, PAGE_SIZE); PrevSize = InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, PAGE_SIZE);
if (PrevSize >= Process->Vm.PeakWorkingSetSize) if (PrevSize >= Process->Vm.PeakWorkingSetSize)
{ {
@ -423,7 +418,6 @@ MmInsertRmap(PFN_NUMBER Page, PEPROCESS Process,
} }
} }
} }
}
VOID VOID
NTAPI NTAPI
@ -455,15 +449,9 @@ MmDeleteRmap(PFN_NUMBER Page, PEPROCESS Process,
ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry); ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
if (!RMAP_IS_SEGMENT(Address)) if (!RMAP_IS_SEGMENT(Address))
{ {
if (Process == NULL) ASSERT(Process != NULL);
{
Process = PsInitialSystemProcess;
}
if (Process)
{
(void)InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE); (void)InterlockedExchangeAddUL(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
} }
}
return; return;
} }
previous_entry = current_entry; previous_entry = current_entry;