소스 검색

Kernel: Make sure to drop region with interrupts enabled

A region can drop an inode if it was mmaped from the inode and held the last
reference to it, and that may require some locking.
Sergey Bugaev 5 년 전
부모
커밋
3645b9e2a6
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      Kernel/Process.cpp

+ 3 - 1
Kernel/Process.cpp

@@ -232,12 +232,14 @@ Region* Process::allocate_region_with_vmobject(VirtualAddress vaddr, size_t size
 
 bool Process::deallocate_region(Region& region)
 {
+    OwnPtr<Region> region_protector;
     ScopedSpinLock lock(m_lock);
+
     if (m_region_lookup_cache.region == &region)
         m_region_lookup_cache.region = nullptr;
     for (size_t i = 0; i < m_regions.size(); ++i) {
         if (&m_regions[i] == &region) {
-            m_regions.unstable_take(i);
+            region_protector = m_regions.unstable_take(i);
             return true;
         }
     }