git: dc6c80476b5a - stable/15 - unmount(2): do not allow MNT_DEFERRED or MNT_RECURSE flags from userspace

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 09 Feb 2026 00:52:23 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c80476b5a2e9aa3cda203e89827fed7e04893

commit dc6c80476b5a2e9aa3cda203e89827fed7e04893
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-02 22:38:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-09 00:51:57 +0000

    unmount(2): do not allow MNT_DEFERRED or MNT_RECURSE flags from userspace
    
    (cherry picked from commit cd8d44173adc375b59a24b1363476c086a7c86b4)
---
 sys/kern/vfs_mount.c | 2 ++
 1 file changed, 2 insertions(+)

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)