From 85c2fc1bcdf8acb430ab04d46865f3e57dee5d01 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 26 Jun 2015 11:02:40 +0000 Subject: [PATCH] [NTOS:MM] - Do not request a page in MiAllocatePagesForMdl if no pages are available. Fixes kmtest:MmMdl. CORE-9879 #resolve svn path=/trunk/; revision=68274 --- reactos/ntoskrnl/mm/freelist.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 00120541c18..849b56788bd 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -232,7 +232,12 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, /* Grab a page */ MI_SET_USAGE(MI_USAGE_MDL); MI_SET_PROCESS2("Kernel"); - Page = MiRemoveAnyPage(0); + + /* FIXME: This check should be smarter */ + Page = 0; + if (MmAvailablePages != 0) + Page = MiRemoveAnyPage(0); + if (Page == 0) { /* This is not good... hopefully we have at least SOME pages */