mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel/FileSystem: Remove disk cache only after ext2 superblock flush
We first must flush the superblock through the BlockBasedFileSystem methods properly and only then clear the DiskCache pointer, to prevent a possible kernel panic due to nullptr dereference.
This commit is contained in:
parent
abf7941bb9
commit
dbab4d34d7
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/supercomputer7
Commit: dbab4d34d7
Pull-request: https://github.com/SerenityOS/serenity/pull/20665
Issue: https://github.com/SerenityOS/serenity/issues/20560
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/BertalanD
1 changed files with 1 additions and 1 deletions
|
@ -589,7 +589,6 @@ ErrorOr<void> Ext2FS::prepare_to_clear_last_mount(Inode& mount_guest_inode)
|
|||
if (any_inode_busy)
|
||||
return EBUSY;
|
||||
|
||||
BlockBasedFileSystem::remove_disk_cache_before_last_unmount();
|
||||
m_inode_cache.clear();
|
||||
m_root_inode = nullptr;
|
||||
|
||||
|
@ -597,6 +596,7 @@ ErrorOr<void> Ext2FS::prepare_to_clear_last_mount(Inode& mount_guest_inode)
|
|||
dmesgln("Ext2FS: Clean unmount, setting superblock to valid state");
|
||||
m_super_block.s_state = EXT2_VALID_FS;
|
||||
TRY(flush_super_block());
|
||||
BlockBasedFileSystem::remove_disk_cache_before_last_unmount();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue