[NTOS:MM] Fix PFN lock usage

This commit is contained in:
Timo Kreuzer 2021-06-07 10:40:20 +02:00
parent f4d47faeb7
commit 33949028fb
2 changed files with 7 additions and 4 deletions

View file

@ -77,6 +77,8 @@ NTSTATUS
NTAPI
MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
{
KIRQL OldIrql;
if (Page == 0)
{
DPRINT1("Tried to release page zero.\n");
@ -85,8 +87,12 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
(void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
OldIrql = MiAcquirePfnLock();
MmDereferencePage(Page);
MiReleasePfnLock(OldIrql);
return(STATUS_SUCCESS);
}

View file

@ -566,10 +566,9 @@ NTAPI
MmDereferencePage(PFN_NUMBER Pfn)
{
PMMPFN Pfn1;
KIRQL OldIrql;
DPRINT("MmDereferencePage(PhysicalAddress %x)\n", Pfn << PAGE_SHIFT);
OldIrql = MiAcquirePfnLock();
MI_ASSERT_PFN_LOCK_HELD();
Pfn1 = MiGetPfnEntry(Pfn);
ASSERT(Pfn1);
@ -596,8 +595,6 @@ MmDereferencePage(PFN_NUMBER Pfn)
DPRINT("Legacy free: %lx\n", Pfn);
MiInsertPageInFreeList(Pfn);
}
MiReleasePfnLock(OldIrql);
}
PFN_NUMBER