mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:34:59 +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
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