mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 10:07:40 +00:00
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.
This commit is contained in:
parent
f945d7c358
commit
6627c3ea3a
1 changed files with 4 additions and 2 deletions
|
@ -4104,14 +4104,16 @@ int Process::sys$mount(const Syscall::SC_mount_params* user_params)
|
||||||
// We're doing a bind mount.
|
// We're doing a bind mount.
|
||||||
if (description.is_null())
|
if (description.is_null())
|
||||||
return -EBADF;
|
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);
|
return VFS::the().bind_mount(*description->custody(), target_custody, params.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs_type == "ext2" || fs_type == "Ext2FS") {
|
if (fs_type == "ext2" || fs_type == "Ext2FS") {
|
||||||
if (description.is_null())
|
if (description.is_null())
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
ASSERT(description->custody());
|
|
||||||
if (!description->file().is_seekable()) {
|
if (!description->file().is_seekable()) {
|
||||||
dbg() << "mount: this is not a seekable file";
|
dbg() << "mount: this is not a seekable file";
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue