1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

Kernel/VFS: Check matching absolute path when jump to mount guest inode

We could easily encounter a case where we do the following:

```
mkdir -p /tmp2
mount /dev/hda /tmp2
```

would produce a bug that doing `ls /tmp2/tmp2` will give the contents
on `/dev/hda` ext2 root directory and also on `/tmp2/tmp2/tmp2` and so
on.
To prevent this, we must compare the current custody against each mount
entry's custody to ensure their paths match.
This commit is contained in:
Liav A 2023-08-04 22:03:24 +03:00 committed by Jelle Raaijmakers
parent 80f400a150
commit e5c7662638
2 changed files with 22 additions and 8 deletions

View file

@ -119,7 +119,7 @@ private:
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);
Mount* find_mount_for_host_custody(Custody const& current_custody);
Mount* find_mount_for_guest(InodeIdentifier);
RefPtr<Inode> m_root_inode;