1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:47:35 +00:00

Kernel: Make PrivateInodeVMObject factory APIs OOM safe

This commit is contained in:
Brian Gianforcaro 2021-05-28 03:18:07 -07:00 committed by Andreas Kling
parent d947253c51
commit 65d5f81afc
4 changed files with 13 additions and 8 deletions

View file

@ -201,7 +201,10 @@ KResult Process::poke_user_data(Userspace<u32*> address, u32 data)
// If the region is shared, we change its vmobject to a PrivateInodeVMObject
// to prevent the write operation from changing any shared inode data
VERIFY(region->vmobject().is_shared_inode());
region->set_vmobject(PrivateInodeVMObject::create_with_inode(static_cast<SharedInodeVMObject&>(region->vmobject()).inode()));
auto vmobject = PrivateInodeVMObject::create_with_inode(static_cast<SharedInodeVMObject&>(region->vmobject()).inode());
if (!vmobject)
return ENOMEM;
region->set_vmobject(vmobject.release_nonnull());
region->set_shared(false);
}
const bool was_writable = region->is_writable();