diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-06-19 14:12:11 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-22 11:01:59 +0200 |
commit | ab7023dbe551d5fdfbc458b2a40cd11ccd4dcab9 (patch) | |
tree | c3925c474ecc31de1678dc12fa2e573d1229bf68 /Kernel/FileSystem/Ext2FileSystem.h | |
parent | f1ac0b6a5ae6c97ea572e46b1707d2f75ecb6d60 (diff) | |
download | serenity-ab7023dbe551d5fdfbc458b2a40cd11ccd4dcab9.zip |
Kernel: Ensure Ext2FSInode's lookup is populated before using it
This fixes #8133.
Ext2FSInode::remove_child() searches the lookup cache, so if it's not
initialized, removing the child fails. If the child was a directory,
this led to it being corrupted and having 0 children.
I also added populate_lookup_cache to add_child. I hadn't seen any
bugs there, but if the cache wasn't populated before, adding that
one entry would make it think it was populated, so that would cause
bugs later.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.h')
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h index 738b506e30..da4584d8de 100644 --- a/Kernel/FileSystem/Ext2FileSystem.h +++ b/Kernel/FileSystem/Ext2FileSystem.h @@ -59,7 +59,7 @@ private: virtual KResultOr<int> get_block_address(int) override; KResult write_directory(Vector<Ext2FSDirectoryEntry>&); - bool populate_lookup_cache() const; + KResult populate_lookup_cache() const; KResult resize(u64); KResult write_indirect_block(BlockBasedFS::BlockIndex, Span<BlockBasedFS::BlockIndex>); KResult grow_doubly_indirect_block(BlockBasedFS::BlockIndex, size_t, Span<BlockBasedFS::BlockIndex>, Vector<BlockBasedFS::BlockIndex>&, unsigned&); |