summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-15 04:16:11 +0200
committerAndreas Kling <kling@serenityos.org>2022-01-15 11:04:07 +0100
commit6e37487477ae3059350a32baa337e376337ad752 (patch)
tree3a9081bb11dd66ab61eb3cd68bf322d0a2d8f2a1 /Kernel/Memory
parent1678dcbf91a1f9d3e6aa4deab41dab9c72e04ff8 (diff)
downloadserenity-6e37487477ae3059350a32baa337e376337ad752.zip
Kernel: Always remove PageDirectories from the cr3 map on destruction
Previously we would only remove them from the map if they were attached to an AddressSpace, even though we would always add them to the map on construction. This results in an assertion failure on destruction if the page directory was never attached to an AddressSpace. (for example, on an allocation failure of said AddressSpace)
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/PageDirectory.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Memory/PageDirectory.cpp b/Kernel/Memory/PageDirectory.cpp
index dda93a48db..c54b95d3c7 100644
--- a/Kernel/Memory/PageDirectory.cpp
+++ b/Kernel/Memory/PageDirectory.cpp
@@ -151,8 +151,7 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
PageDirectory::~PageDirectory()
{
SpinlockLocker lock(s_mm_lock);
- if (m_space)
- cr3_map().remove(cr3());
+ cr3_map().remove(cr3());
}
}