mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
Kernel: Return -ENOTDIR for non-directory mount target
The absence of this check allowed silly things like this: # touch file # mount /dev/hda file
This commit is contained in:
parent
6876b9a514
commit
b7b09470ca
Notes:
sideshowbarker
2024-07-18 22:46:54 +09:00
Author: https://github.com/linusg
Commit: b7b09470ca
Pull-request: https://github.com/SerenityOS/serenity/pull/5157
2 changed files with 4 additions and 0 deletions
|
@ -67,6 +67,9 @@ int Process::sys$mount(Userspace<const Syscall::SC_mount_params*> user_params)
|
|||
|
||||
auto& target_custody = custody_or_error.value();
|
||||
|
||||
if (!target_custody->inode().is_directory())
|
||||
return -ENOTDIR;
|
||||
|
||||
if (params.flags & MS_REMOUNT) {
|
||||
// We're not creating a new mount, we're updating an existing one!
|
||||
return VFS::the().remount(target_custody, params.flags & ~MS_REMOUNT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue