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.
This commit is contained in:
Liav A 2023-05-26 14:04:53 +03:00 committed by Andreas Kling
parent 46ef2f8e20
commit 2ab657d3b5

View file

@ -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];