diff options
author | ssouhlal <ssouhlal@FreeBSD.org> | 2006-01-28 22:58:39 +0000 |
---|---|---|
committer | ssouhlal <ssouhlal@FreeBSD.org> | 2006-01-28 22:58:39 +0000 |
commit | 0ee4f07a23fdada690fae1a62990fe87d59a0efd (patch) | |
tree | abe9fcd9074a7c607a6a733e4d8c25583b9e1549 /sys/kern/vfs_mount.c | |
parent | fe40c5679718d69f882a11ad0450db68d1575af5 (diff) | |
download | FreeBSD-src-0ee4f07a23fdada690fae1a62990fe87d59a0efd.zip FreeBSD-src-0ee4f07a23fdada690fae1a62990fe87d59a0efd.tar.gz |
Don't try to load KLDs if we're mounting the root. We'd otherwise panic.
Tested by: kris
MFC after: 3 days
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r-- | sys/kern/vfs_mount.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 4b57575..2015a43 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -818,10 +818,18 @@ vfs_domount( vput(vp); return (ENOTDIR); } - vfsp = vfs_byname_kld(fstype, td, &error); - if (vfsp == NULL) { - vput(vp); - return (error); + /* Don't try to load KLDs if we're mounting the root. */ + if (fsflags & MNT_ROOTFS) { + if ((vfsp = vfs_byname(fstype)) == NULL) { + vput(vp); + return (ENODEV); + } + } else { + vfsp = vfs_byname_kld(fstype, td, &error); + if (vfsp == NULL) { + vput(vp); + return (error); + } } VI_LOCK(vp); if ((vp->v_iflag & VI_MOUNT) != 0 || |