kernel/vm: Handle vm_copy_on_write_area failing properly.
Just delete the newly-created area and return the error. Fixes #13455.
This commit is contained in:
@@ -3004,14 +3004,14 @@ vm_copy_area(team_id team, const char* name, void** _address,
|
|||||||
cache->AcquireRefLocked();
|
cache->AcquireRefLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the source area is writable, we need to move it one layer up as well
|
// If the source area is writable, we need to move it one layer up as well.
|
||||||
if (!sharedArea) {
|
if (!sharedArea && writableCopy) {
|
||||||
if (writableCopy) {
|
status_t status = vm_copy_on_write_area(cache,
|
||||||
// TODO: do something more useful if this fails!
|
wiredPages > 0 ? &wiredPagesReservation : NULL);
|
||||||
if (vm_copy_on_write_area(cache,
|
if (status != B_OK) {
|
||||||
wiredPages > 0 ? &wiredPagesReservation : NULL) < B_OK) {
|
cacheLocker.Unlock();
|
||||||
panic("vm_copy_on_write_area() failed!\n");
|
delete_area(targetAddressSpace, target, false);
|
||||||
}
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user