https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54354712e25df2aa2cf56…
commit 54354712e25df2aa2cf562de4dd9251365a041fe
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Mon Feb 22 11:43:04 2021 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Thu Mar 18 12:24:21 2021 +0100
[NTOS:MM] Fail allocating non-paged pool when running out of available pages
---
ntoskrnl/mm/ARM3/pool.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/ntoskrnl/mm/ARM3/pool.c b/ntoskrnl/mm/ARM3/pool.c
index 7c0e1bb93ba..9490f326874 100644
--- a/ntoskrnl/mm/ARM3/pool.c
+++ b/ntoskrnl/mm/ARM3/pool.c
@@ -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
//