summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-25 12:06:43 +0000
committerphk <phk@FreeBSD.org>2004-11-25 12:06:43 +0000
commit8cb05dfca4b7670618b80360b20f2aed4de4d3a5 (patch)
treef73f27117a959440e4d236bbba645ba3d73cc171 /sys
parentf4e37f6f60d1d3f8f8e334738707004bbfc62c41 (diff)
downloadFreeBSD-src-8cb05dfca4b7670618b80360b20f2aed4de4d3a5.zip
FreeBSD-src-8cb05dfca4b7670618b80360b20f2aed4de4d3a5.tar.gz
Assert Giant held in vfs_domount() and vfs_dounmount()
Explicitly grab Giant before calling these.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_mount.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 917d4e2..b4b37a0 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -576,7 +576,9 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
goto bail;
}
+ mtx_lock(&Giant);
error = vfs_domount(td, fstype, fspath, fsflags, optlist, 0);
+ mtx_unlock(&Giant);
bail:
if (error)
vfs_freeopts(optlist);
@@ -619,9 +621,12 @@ mount(td, uap)
error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL);
if (error == 0)
error = copyinstr(uap->path, fspath, MNAMELEN, NULL);
- if (error == 0)
+ if (error == 0) {
+ mtx_lock(&Giant);
error = vfs_domount(td, fstype, fspath, uap->flags,
uap->data, 1);
+ mtx_unlock(&Giant);
+ }
free(fstype, M_TEMP);
free(fspath, M_TEMP);
return (error);
@@ -643,8 +648,12 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
int fsflags;
void *fsdata;
{
+ int error;
- return (vfs_domount(td, fstype, fspath, fsflags, fsdata, 1));
+ mtx_lock(&Giant);
+ error = vfs_domount(td, fstype, fspath, fsflags, fsdata, 1);
+ mtx_unlock(&Giant);
+ return (error);
}
/*
@@ -668,6 +677,8 @@ vfs_domount(
struct vattr va;
struct nameidata nd;
+ mtx_assert(&Giant, MA_OWNED);
+
/*
* Be ultra-paranoid about making sure the type and fspath
* variables will fit in our mp buffers, including the
@@ -1067,7 +1078,10 @@ unmount(td, uap)
*/
if (mp->mnt_flag & MNT_ROOTFS)
return (EINVAL);
- return (dounmount(mp, uap->flags, td));
+ mtx_lock(&Giant);
+ error = dounmount(mp, uap->flags, td);
+ mtx_unlock(&Giant);
+ return (error);
}
/*
@@ -1083,6 +1097,8 @@ dounmount(mp, flags, td)
int error;
int async_flag;
+ mtx_assert(&Giant, MA_OWNED);
+
mtx_lock(&mountlist_mtx);
if (mp->mnt_kern_flag & MNTK_UNMOUNT) {
mtx_unlock(&mountlist_mtx);
@@ -1568,6 +1584,7 @@ __mnt_vnode_next(struct vnode **nvp, struct mount *mp)
struct vnode *vp;
mtx_assert(&mp->mnt_mtx, MA_OWNED);
+
vp = *nvp;
/* Check if we are done */
if (vp == NULL)
OpenPOWER on IntegriCloud