1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

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
parent 0ae5de8c3c
commit 485f51690d
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;
}