[NTOS:CC]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 9 Aug 2016 07:59:07 +0000 (07:59 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 9 Aug 2016 07:59:07 +0000 (07:59 +0000)
- Gracefully handle failure to obtain virtual memory when creating a VACB. We now no longer crash when running out of virtual memory during (large) file operations (but will still crash when running out of physical memory).
CORE-11533

svn path=/trunk/; revision=72164

reactos/ntoskrnl/cc/view.c

index 295471d..1c773bf 100644 (file)
@@ -594,7 +594,8 @@ CcRosMapVacb(
     MmUnlockAddressSpace(MmGetKernelAddressSpace());
     if (!NT_SUCCESS(Status))
     {
-        KeBugCheck(CACHE_MANAGER);
+        DPRINT1("MmCreateMemoryArea failed with %lx for VACB %p\n", Status, Vacb);
+        return Status;
     }
 
     ASSERT(((ULONG_PTR)Vacb->BaseAddress % PAGE_SIZE) == 0);
@@ -746,6 +747,13 @@ CcRosCreateVacb (
 #endif
 
     Status = CcRosMapVacb(current);
+    if (!NT_SUCCESS(Status))
+    {
+        RemoveEntryList(&current->CacheMapVacbListEntry);
+        RemoveEntryList(&current->VacbLruListEntry);
+        CcRosReleaseVacbLock(current);
+        ExFreeToNPagedLookasideList(&VacbLookasideList, current);
+    }
 
     return Status;
 }