Kernel: Always observe the return value of Region::map and remap

We have seen cases where the map fails, but we return the region
to the caller, causing them to page fault later on when they touch
the region.

The fix is to always observe the return code of map/remap.
This commit is contained in:
Brian Gianforcaro 2021-08-24 12:53:47 -07:00 committed by Andreas Kling
commit 485f51690d
Notes: sideshowbarker 2024-07-18 05:19:11 +09:00
5 changed files with 28 additions and 12 deletions

View file

@ -748,7 +748,8 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region_with_vmobject(VirtualRange
return {};
auto region = maybe_region.release_value();
region->map(kernel_page_directory());
if (!region->map(kernel_page_directory()))
return {};
return region;
}