summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-11-03 14:29:09 +0000
committerpeter <peter@FreeBSD.org>1998-11-03 14:29:09 +0000
commit43589c7042343335851bafe0fd3d06e47bd64e80 (patch)
tree58d5459c0b59c50da3acb1d8317ae5673023d387 /sys/kern/vfs_syscalls.c
parent2b6debf094bac2f5d1036c8beae2f16461481b48 (diff)
downloadFreeBSD-src-43589c7042343335851bafe0fd3d06e47bd64e80.zip
FreeBSD-src-43589c7042343335851bafe0fd3d06e47bd64e80.tar.gz
make mount(2) automatically kldload modules if the requested filesystem
isn't present.
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 43f7856..1482df6 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.108 1998/10/31 07:42:04 peter Exp $
+ * $Id: vfs_syscalls.c,v 1.109 1998/11/03 08:01:47 peter Exp $
*/
/* For 4.3 integer FS ID compatibility */
@@ -51,6 +51,7 @@
#include <sys/kernel.h>
#include <sys/fcntl.h>
#include <sys/file.h>
+#include <sys/linker.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#include <sys/vnode.h>
@@ -224,8 +225,36 @@ mount(p, uap)
if (!strcmp(vfsp->vfc_name, fstypename))
break;
if (vfsp == NULL) {
- vput(vp);
- return (ENODEV);
+ linker_file_t lf;
+
+ /* Refuse to load modules if securelevel raised */
+ if (securelevel > 0) {
+ vput(vp);
+ return EPERM;
+ }
+ /* Only load modules for root (very important!) */
+ if (error = suser(p->p_ucred, &p->p_acflag)) {
+ vput(vp);
+ return error;
+ }
+ error = linker_load_file(fstypename, &lf);
+ if (error || lf == NULL) {
+ vput(vp);
+ if (lf == NULL)
+ error = ENODEV;
+ return error;
+ }
+ lf->userrefs++;
+ /* lookup again, see if the VFS was loaded */
+ for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
+ if (!strcmp(vfsp->vfc_name, fstypename))
+ break;
+ if (vfsp == NULL) {
+ lf->userrefs--;
+ linker_file_unload(lf);
+ vput(vp);
+ return (ENODEV);
+ }
}
simple_lock(&vp->v_interlock);
if ((vp->v_flag & VMOUNT) != 0 ||
OpenPOWER on IntegriCloud