1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:35:06 +00:00

Kernel: InodeVMObject can't call Inode::size() with interrupts disabled

Inode::size() may try to take a lock, so we can't be calling it with
interrupts disabled.

This fixes a kernel hang when trying to execute a binary in a TmpFS.
This commit is contained in:
Andreas Kling 2020-01-03 15:40:03 +01:00
parent 1dc64ec064
commit aba7829724
2 changed files with 5 additions and 4 deletions

View file

@ -5,10 +5,11 @@
NonnullRefPtr<InodeVMObject> InodeVMObject::create_with_inode(Inode& inode)
{
size_t size = inode.size();
InterruptDisabler disabler;
if (inode.vmobject())
return *inode.vmobject();
auto vmobject = adopt(*new InodeVMObject(inode));
auto vmobject = adopt(*new InodeVMObject(inode, size));
vmobject->inode().set_vmobject(*vmobject);
return vmobject;
}
@ -18,8 +19,8 @@ NonnullRefPtr<VMObject> InodeVMObject::clone()
return adopt(*new InodeVMObject(*this));
}
InodeVMObject::InodeVMObject(Inode& inode)
: VMObject(inode.size())
InodeVMObject::InodeVMObject(Inode& inode, size_t size)
: VMObject(size)
, m_inode(inode)
, m_dirty_pages(page_count(), false)
{