summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2018-07-11 17:44:58 +0000
committerkn <kn@cvs.openbsd.org>2018-07-11 17:44:58 +0000
commit9a719bbcf4d98dd0a84c970ed5052dbf646923a0 (patch)
treec5a6936a095fd2dcef073252c739a6699721f71a
parent64f679147501c3b8342e01fb298b344d316d637a (diff)
Prevent updating async option on softdep mount
`mount -uo async,nosoftdep /mnt' would set "async" but keep "softdep" untouched on a read/write mount. OK deraadt krw beck bluhm
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 0695d54a489..6c52beaa6f8 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.177 2018/05/27 06:02:15 visa Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.178 2018/07/11 17:44:57 kn Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -241,6 +241,16 @@ ffs_mount(struct mount *mp, const char *path, void *data,
error = 0;
ronly = fs->fs_ronly;
+ /*
+ * Soft updates won't be set if read/write,
+ * so "async" will be illegal.
+ */
+ if (ronly == 0 && (mp->mnt_flag & MNT_ASYNC) &&
+ (fs->fs_flags & FS_DOSOFTDEP)) {
+ error = EINVAL;
+ goto error_1;
+ }
+
if (ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
/* Flush any dirty data */
VFS_SYNC(mp, MNT_WAIT, 0, p->p_ucred, p);