mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
Kernel/VFS: Ensure Custodies' absolute path don't match before mounting
This ensures that the host mount point custody path is not the same like the new to-be-mounted custody. A scenario that could happen before adding this check is: ``` mkdir -p /tmp2 mount /dev/hda /tmp2/ mount /dev/hda /tmp2/ mount /dev/hda /tmp2/ # this will fail here ``` and after adding this check, the following scenario is now this: ``` mkdir -p /tmp2 mount /dev/hda /tmp2/ mount /dev/hda /tmp2/ # this will fail here mount /dev/hda /tmp2/ # this will fail here too ```
This commit is contained in:
parent
8da7d84512
commit
debbfe07fb
Notes:
sideshowbarker
2024-07-16 23:34:44 +09:00
Author: https://github.com/supercomputer7
Commit: debbfe07fb
Pull-request: https://github.com/SerenityOS/serenity/pull/20358
Reviewed-by: https://github.com/gmta ✅
2 changed files with 30 additions and 9 deletions
|
@ -115,7 +115,8 @@ private:
|
|||
|
||||
ErrorOr<void> traverse_directory_inode(Inode&, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>);
|
||||
|
||||
bool mount_point_exists_at_inode(InodeIdentifier inode);
|
||||
static bool check_matching_absolute_path_hierarchy(Custody const& first_custody, Custody const& second_custody);
|
||||
bool mount_point_exists_at_custody(Custody& mount_point);
|
||||
|
||||
// FIXME: These functions are totally unsafe as someone could unmount the returned Mount underneath us.
|
||||
Mount* find_mount_for_host(InodeIdentifier);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue