git: 84337218786b - main - nmount(2), NFS: Accept 'ngroups_max + 1' groups in "export" credentials

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Mon, 16 Dec 2024 14:45:28 UTC
The branch main has been updated by olce:

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

commit 84337218786b13f0ebfa834d28de41dce02bc937
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-10-08 09:39:08 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-12-16 14:42:30 +0000

    nmount(2), NFS: Accept 'ngroups_max + 1' groups in "export" credentials
    
    There is no technical reason to limit that to NGROUPS_MAX, which is off
    by one and just our minimum maximum value.
    
    Reviewed by:    rmacklem
    Approved by:    markj (mentor)
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D47013
---
 sys/kern/vfs_mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index f5ff8d54fadd..a09a3049d79c 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1497,7 +1497,7 @@ vfs_domount_update(
 			bcopy(bufp, &export, len);
 			grps = NULL;
 			if (export.ex_ngroups > 0) {
-				if (export.ex_ngroups <= NGROUPS_MAX) {
+				if (export.ex_ngroups <= ngroups_max + 1) {
 					grps = malloc(export.ex_ngroups *
 					    sizeof(gid_t), M_TEMP, M_WAITOK);
 					export_error = copyin(export.ex_groups,