aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-02-02 22:38:32 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-02-03 10:25:47 +0000
commitcd8d44173adc375b59a24b1363476c086a7c86b4 (patch)
treebcadd28b0e48d77f3623f560dd4d1abf00087afa
parente1f36b9db9220cf51c6c3d2d2ad230fb9490bc3e (diff)
unmount(2): do not allow MNT_DEFERRED or MNT_RECURSE flags from userspace
Repprted and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
-rw-r--r--sys/kern/vfs_mount.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 13403acacc08..240bf5451a84 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1733,6 +1733,8 @@ kern_unmount(struct thread *td, const char *path, int flags)
int error;
AUDIT_ARG_VALUE(flags);
+ if ((flags & (MNT_DEFERRED | MNT_RECURSE)) != 0)
+ return (EINVAL);
if (jailed(td->td_ucred) || usermount == 0) {
error = priv_check(td, PRIV_VFS_UNMOUNT);
if (error)