mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 06:47:40 +00:00
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.
This commit is contained in:
parent
6111cfda73
commit
3645b9e2a6
1 changed files with 3 additions and 1 deletions
|
@ -232,12 +232,14 @@ Region* Process::allocate_region_with_vmobject(VirtualAddress vaddr, size_t size
|
||||||
|
|
||||||
bool Process::deallocate_region(Region& region)
|
bool Process::deallocate_region(Region& region)
|
||||||
{
|
{
|
||||||
|
OwnPtr<Region> region_protector;
|
||||||
ScopedSpinLock lock(m_lock);
|
ScopedSpinLock lock(m_lock);
|
||||||
|
|
||||||
if (m_region_lookup_cache.region == ®ion)
|
if (m_region_lookup_cache.region == ®ion)
|
||||||
m_region_lookup_cache.region = nullptr;
|
m_region_lookup_cache.region = nullptr;
|
||||||
for (size_t i = 0; i < m_regions.size(); ++i) {
|
for (size_t i = 0; i < m_regions.size(); ++i) {
|
||||||
if (&m_regions[i] == ®ion) {
|
if (&m_regions[i] == ®ion) {
|
||||||
m_regions.unstable_take(i);
|
region_protector = m_regions.unstable_take(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue