From c4f456e3bd26daada9458ccd3494fdba4626c719 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Tue, 11 Aug 2015 08:21:36 +0000 Subject: [PATCH] [NTOS:MM] - When paging in data for an image section, first flush outstanding cached data since paging reads are noncached. Fixes failure to create section in ntdll_apitest:NtMapViewOfSection/Test_NoLoadSection - Gracefully handle out-of-pool situation CORE-8384 svn path=/trunk/; revision=68677 --- reactos/ntoskrnl/mm/section.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index e95de54134c..1f0f99e72f2 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -3236,6 +3236,12 @@ ExeFmtpReadFile(IN PVOID File, BufferSize = Length + OffsetAdjustment; BufferSize = PAGE_ROUND_UP(BufferSize); + /* Flush data since we're about to perform a non-cached read */ + CcFlushCache(FileObject->SectionObjectPointer, + &FileOffset, + BufferSize, + &Iosb); + /* * It's ok to use paged pool, because this is a temporary buffer only used in * the loading of executables. The assumption is that MmCreateSection is @@ -3247,7 +3253,7 @@ ExeFmtpReadFile(IN PVOID File, 'rXmM'); if (!Buffer) { - KeBugCheck(MEMORY_MANAGEMENT); + return STATUS_INSUFFICIENT_RESOURCES; } UsedSize = 0;