diff options
author | phk <phk@FreeBSD.org> | 2004-11-09 22:21:10 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-11-09 22:21:10 +0000 |
commit | 37ad4f1923f750790407861ce00a1e96c5f1b0be (patch) | |
tree | a0898a9eb72f91239f4c43f21404a108a77b4bc4 | |
parent | 921930c5854fc8118d129cc5be63eb03148ece00 (diff) | |
download | FreeBSD-src-37ad4f1923f750790407861ce00a1e96c5f1b0be.zip FreeBSD-src-37ad4f1923f750790407861ce00a1e96c5f1b0be.tar.gz |
Refuse attempts to mount root filesystem
-rw-r--r-- | sys/fs/nullfs/null_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/portalfs/portal_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_vfsops.c | 5 | ||||
-rw-r--r-- | sys/fs/umapfs/umap_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/unionfs/union_vfsops.c | 2 | ||||
-rw-r--r-- | sys/nfs4client/nfs4_vfsops.c | 2 |
7 files changed, 11 insertions, 6 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index ea49163..d834d04 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -85,6 +85,8 @@ nullfs_mount(struct mount *mp, struct thread *td) NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp); + if (mp->mnt_flag & MNT_ROOTFS) + return (EOPNOTSUPP); /* * Update is a no-op */ diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index 2900048..5d807ab 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -147,6 +147,8 @@ static int nwfs_omount(struct mount *mp, char *path, caddr_t data, struct vnode *vp; char *pc,*pe; + if (mp->mnt_flag & MNT_ROOTFS) + return (EOPNOTSUPP); if (data == NULL) { nwfs_printf("missing data argument\n"); return 1; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index dea2d39..5ff1138 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -85,7 +85,7 @@ portal_omount(mp, path, data, td) /* * Update is a no-op */ - if (mp->mnt_flag & MNT_UPDATE) + if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) return (EOPNOTSUPP); error = copyin(data, (caddr_t) &args, sizeof(struct portal_args)); diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index d8d90e4..e841f91 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -122,10 +122,9 @@ smbfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td) printf("missing data argument\n"); return EINVAL; } - if (mp->mnt_flag & MNT_UPDATE) { - printf("MNT_UPDATE not implemented"); + if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) return EOPNOTSUPP; - } + error = copyin(data, (caddr_t)&args, sizeof(struct smbfs_args)); if (error) return error; diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index c9da7f7..1417429 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -99,7 +99,7 @@ umapfs_omount(mp, path, data, ndp, td) /* * Update is a no-op */ - if (mp->mnt_flag & MNT_UPDATE) { + if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) { return (EOPNOTSUPP); /* return (VFS_MOUNT(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, path, data, ndp, td));*/ } diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index bf3fcfa..7383c0c 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -89,6 +89,8 @@ union_mount(mp, td) */ mp->mnt_flag |= MNT_NOCLUSTERW; + if (mp->mnt_flag & MNT_ROOTFS) + return (EOPNOTSUPP); /* * Update is a no-op */ diff --git a/sys/nfs4client/nfs4_vfsops.c b/sys/nfs4client/nfs4_vfsops.c index 6732c8c..24ba1af 100644 --- a/sys/nfs4client/nfs4_vfsops.c +++ b/sys/nfs4client/nfs4_vfsops.c @@ -393,7 +393,7 @@ nfs_omount(struct mount *mp, char *path, caddr_t data, struct thread *td) char hst[MNAMELEN]; size_t len; - if (path == NULL) { + if (mp->mnt_flag & MNT_ROOTFS) { printf("NFSv4: nfs_mountroot not supported\n"); return EINVAL; } |