summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-05-28 17:47:33 +0300
committerAndreas Kling <kling@serenityos.org>2020-05-29 07:53:30 +0200
commit6627c3ea3acc9fa9d93c7d7f7c82a5514cce1863 (patch)
tree650acd918f35d81d5cfbe8a912bd8299ecac8d5f /Kernel
parentf945d7c3589a85f29975f104d88908c4990dd0f0 (diff)
downloadserenity-6627c3ea3acc9fa9d93c7d7f7c82a5514cce1863.zip
Kernel: Fix some failing assertions
When mounting Ext2FS, we don't care if the file has a custody (it doesn't if it's a device, which is a common case). When doing a bind-mount, we do need a custody; if none is provided, let's return an error instead of crashing.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index d5dbc4ff1b..d6227c8fc0 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -4104,14 +4104,16 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params)
// We're doing a bind mount.
if (description.is_null())
return -EBADF;
- ASSERT(description->custody());
+ if (!description->custody()) {
+ // We only support bind-mounting inodes, not arbitrary files.
+ return -ENODEV;
+ }
return VFS::the().bind_mount(*description->custody(), target_custody, params.flags);
}
if (fs_type == "ext2" || fs_type == "Ext2FS") {
if (description.is_null())
return -EBADF;
- ASSERT(description->custody());
if (!description->file().is_seekable()) {
dbg() << "mount: this is not a seekable file";
return -ENODEV;