diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 16:07:45 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 16:07:45 +0100 |
commit | abdf24cb7316994614ecfe50d83d40934dc0f7e5 (patch) | |
tree | 8beba63ecf6458cce864c42b100473dea2811805 /VirtualFileSystem | |
parent | 3b2dcd5929316dae75147c84b243ae69a2101af5 (diff) | |
download | serenity-abdf24cb7316994614ecfe50d83d40934dc0f7e5.zip |
Fix deadlock in synthfs read implementation.
Not cool disabling interrupts and then calling out to arbitrary code.
Diffstat (limited to 'VirtualFileSystem')
-rw-r--r-- | VirtualFileSystem/SyntheticFileSystem.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/VirtualFileSystem/SyntheticFileSystem.cpp b/VirtualFileSystem/SyntheticFileSystem.cpp index a3e1408215..dd1c0c0de3 100644 --- a/VirtualFileSystem/SyntheticFileSystem.cpp +++ b/VirtualFileSystem/SyntheticFileSystem.cpp @@ -194,8 +194,6 @@ bool SyntheticFileSystem::writeInode(InodeIdentifier, const ByteBuffer&) Unix::ssize_t SyntheticFileSystem::readInodeBytes(InodeIdentifier inode, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor* handle) const { - InterruptDisabler disabler; - ASSERT(inode.fileSystemID() == id()); #ifdef SYNTHFS_DEBUG kprintf("synthfs: readInode %u\n", inode.index()); @@ -203,10 +201,15 @@ Unix::ssize_t SyntheticFileSystem::readInodeBytes(InodeIdentifier inode, Unix::o ASSERT(offset >= 0); ASSERT(buffer); - auto it = m_inodes.find(inode.index()); - if (it == m_inodes.end()) - return false; - const File& file = *(*it).value; + const File* found_file; + { + InterruptDisabler disabler; + auto it = m_inodes.find(inode.index()); + if (it == m_inodes.end()) + return false; + found_file = (*it).value.ptr(); + } + const File& file = *found_file; ByteBuffer generatedData; if (file.generator) { if (!handle) { |