summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-05-26 14:04:53 +0300
committerAndreas Kling <kling@serenityos.org>2023-05-27 10:58:58 +0200
commit2ab657d3b54b71062d6afc923470d64f048cb387 (patch)
treed146dd11f40d3cd3344cff37a27b28f19ef7ff51 /Kernel/FileSystem
parent46ef2f8e202b97c302633faca82ce106671d07bc (diff)
downloadserenity-2ab657d3b54b71062d6afc923470d64f048cb387.zip
Kernel: Make Ext2FSInode::traverse_as_directory to take m_inode_lock
The contents of the directory inode could change if we are not taking so we must take the m_inode_lock to prevent corruption when reading the directory contents.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/Ext2FS/Inode.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/FileSystem/Ext2FS/Inode.cpp b/Kernel/FileSystem/Ext2FS/Inode.cpp
index 3c5dcaf8ac..cef7507fb8 100644
--- a/Kernel/FileSystem/Ext2FS/Inode.cpp
+++ b/Kernel/FileSystem/Ext2FS/Inode.cpp
@@ -728,6 +728,7 @@ ErrorOr<size_t> Ext2FSInode::write_bytes_locked(off_t offset, size_t count, User
ErrorOr<void> Ext2FSInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{
+ MutexLocker locker(m_inode_lock);
VERIFY(is_directory());
u8 buffer[max_block_size];