mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:27:36 +00:00
Kernel: Fail with ENOMEM if there's insufficient VM for a SharedBuffer
This commit is contained in:
parent
30a8991dbf
commit
cb9d9846e0
1 changed files with 2 additions and 0 deletions
|
@ -88,6 +88,8 @@ void* SharedBuffer::ref_for_process_and_get_address(Process& process)
|
||||||
if (ref.pid == process.pid()) {
|
if (ref.pid == process.pid()) {
|
||||||
if (!ref.region) {
|
if (!ref.region) {
|
||||||
auto* region = process.allocate_region_with_vmobject(VirtualAddress(), size(), m_vmobject, 0, "SharedBuffer", PROT_READ | (m_writable ? PROT_WRITE : 0));
|
auto* region = process.allocate_region_with_vmobject(VirtualAddress(), size(), m_vmobject, 0, "SharedBuffer", PROT_READ | (m_writable ? PROT_WRITE : 0));
|
||||||
|
if (!region)
|
||||||
|
return (void*)-ENOMEM;
|
||||||
ref.region = region->make_weak_ptr();
|
ref.region = region->make_weak_ptr();
|
||||||
ref.region->set_shared(true);
|
ref.region->set_shared(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue