summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2022-03-13 04:00:51 +0000
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-03-12 21:45:57 -0800
commit03342876b8e27b945b0f59fac7dd554f60964fcd (patch)
treea4ddffaf6c4237acac2c65dfd0c15174ac1ea557
parent3b39e16e8ff392b983cee06f66837a5dcc415828 (diff)
downloadserenity-03342876b8e27b945b0f59fac7dd554f60964fcd.zip
Revert "Kernel: Use an ArmedScopeGuard to revert changes after failed mmap"
This reverts commit 790d620b398e0196f3f24e0f0f1cc7be1915eb5f.
-rw-r--r--Kernel/Syscalls/mmap.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp
index bf3030f524..cfe775c20c 100644
--- a/Kernel/Syscalls/mmap.cpp
+++ b/Kernel/Syscalls/mmap.cpp
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <AK/kmalloc.h>
#include <Kernel/Arch/SmapDisabler.h>
#include <Kernel/Arch/x86/MSR.h>
#include <Kernel/Arch/x86/SafeMem.h>
@@ -185,16 +184,8 @@ ErrorOr<FlatPtr> Process::sys$mmap(Userspace<const Syscall::SC_mmap_params*> use
return EINVAL;
Memory::Region* region = nullptr;
- Memory::VirtualRange range { {}, 0 };
- ArmedScopeGuard scope_guard = [&] {
- if (region)
- address_space().deallocate_region(*region);
- else if (range.is_valid())
- address_space().page_directory().range_allocator().deallocate(range);
- };
-
- range = TRY([&]() -> ErrorOr<Memory::VirtualRange> {
+ auto range = TRY([&]() -> ErrorOr<Memory::VirtualRange> {
if (map_randomized)
return address_space().page_directory().range_allocator().try_allocate_randomized(rounded_size, alignment);
@@ -257,8 +248,6 @@ ErrorOr<FlatPtr> Process::sys$mmap(Userspace<const Syscall::SC_mmap_params*> use
PerformanceManager::add_mmap_perf_event(*this, *region);
- scope_guard.disarm();
-
return region->vaddr().get();
}