git: cd8d44173adc - main - unmount(2): do not allow MNT_DEFERRED or MNT_RECURSE flags from userspace

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 03 Feb 2026 10:26:07 UTC
The branch main has been updated by kib:

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

commit cd8d44173adc375b59a24b1363476c086a7c86b4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-02 22:38:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-03 10:25:47 +0000

    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
---
 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)