[NTOS:MM] Fail allocating non-paged pool when running out of available pages

This commit is contained in:
Jérôme Gardou 2021-02-22 11:43:04 +01:00 committed by Jérôme Gardou
parent 34630a06ca
commit 54354712e2

View file

@ -849,6 +849,19 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType,
//
MiAcquirePfnLockAtDpcLevel();
/* Check that we have enough available pages for this request */
if (MmAvailablePages < SizeInPages)
{
MiReleasePfnLockFromDpcLevel();
KeReleaseQueuedSpinLock(LockQueueMmNonPagedPoolLock, OldIrql);
MiReleaseSystemPtes(StartPte, SizeInPages, NonPagedPoolExpansion);
DPRINT1("OUT OF AVAILABLE PAGES! Required %lu, Available %lu\n", SizeInPages, MmAvailablePages);
return NULL;
}
//
// Loop the pages
//