From cf8ce839dac3474bf0b1782323fb85822de15d3f Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 20 Aug 2020 16:41:05 -0600 Subject: [PATCH] Kernel: Fix assertion when releasing contiguous memory region There is no guarantee that the memory manager lock is held when physical pages are released, so just acquire the memory manager lock. --- Kernel/VM/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 977285dcd8..8280503679 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -453,7 +453,7 @@ RefPtr MemoryManager::allocate_user_physical_page(ShouldZeroFill s void MemoryManager::deallocate_supervisor_physical_page(PhysicalPage&& page) { - ASSERT(s_mm_lock.is_locked()); + ScopedSpinLock lock(s_mm_lock); for (auto& region : m_super_physical_regions) { if (!region.contains(page)) { klog() << "MM: deallocate_supervisor_physical_page: " << page.paddr() << " not in " << region.lower() << " -> " << region.upper();