From 2ab657d3b54b71062d6afc923470d64f048cb387 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 26 May 2023 14:04:53 +0300 Subject: [PATCH] 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. --- Kernel/FileSystem/Ext2FS/Inode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/FileSystem/Ext2FS/Inode.cpp b/Kernel/FileSystem/Ext2FS/Inode.cpp index 3c5dcaf8ac8..cef7507fb86 100644 --- a/Kernel/FileSystem/Ext2FS/Inode.cpp +++ b/Kernel/FileSystem/Ext2FS/Inode.cpp @@ -728,6 +728,7 @@ ErrorOr Ext2FSInode::write_bytes_locked(off_t offset, size_t count, User ErrorOr Ext2FSInode::traverse_as_directory(Function(FileSystem::DirectoryEntryView const&)> callback) const { + MutexLocker locker(m_inode_lock); VERIFY(is_directory()); u8 buffer[max_block_size];