diff options
author | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2021-08-14 20:06:08 +0000 |
---|---|---|
committer | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2021-09-15 14:25:31 +0000 |
commit | 6e8272f317b899438165108a72fa04a4995611bd (patch) | |
tree | aea32b2557efe1974ed371b0ad8b59e422e25909 /sys/kern/vfs_mount.c | |
parent | 2de4c7f6d08798fb6269582907155703d1ab5ef4 (diff) | |
download | src-6e8272f317b899438165108a72fa04a4995611bd.tar.gz src-6e8272f317b899438165108a72fa04a4995611bd.zip |
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r-- | sys/kern/vfs_mount.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 73fd8321c9da..55c62b7fe491 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -966,6 +966,12 @@ vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions) } error = vfs_domount(td, fstype, fspath, fsflags, &optlist); + if (error == ENOENT) { + error = EINVAL; + if (errmsg != NULL) + strncpy(errmsg, "Invalid fstype", errmsg_len); + goto bail; + } /* * See if we can mount in the read-only mode if the error code suggests @@ -1525,12 +1531,13 @@ vfs_domount( vfsp = NULL; if ((fsflags & MNT_UPDATE) == 0) { /* Don't try to load KLDs if we're mounting the root. */ - if (fsflags & MNT_ROOTFS) - vfsp = vfs_byname(fstype); - else - vfsp = vfs_byname_kld(fstype, td, &error); - if (vfsp == NULL) - return (ENODEV); + if (fsflags & MNT_ROOTFS) { + if ((vfsp = vfs_byname(fstype)) == NULL) + return (ENODEV); + } else { + if ((vfsp = vfs_byname_kld(fstype, td, &error)) == NULL) + return (error); + } } /* |