瀏覽代碼

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.
Tom 5 年之前
父節點
當前提交
cf8ce839da
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Kernel/VM/MemoryManager.cpp

+ 1 - 1
Kernel/VM/MemoryManager.cpp

@@ -453,7 +453,7 @@ RefPtr<PhysicalPage> 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();