git: 46f0ef933d28 - stable/13 - nmount(2), NFS: Accept 'ngroups_max + 1' groups in "export" credentials

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 12:27:14 UTC
The branch stable/13 has been updated by olce:

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

commit 46f0ef933d288c151accc95cc4717cf6abada83d
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-10-08 09:39:08 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-01-17 12:24:52 +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
    
    (cherry picked from commit 84337218786b13f0ebfa834d28de41dce02bc937)
---
 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 8cee38c7ec2e..11e3ddc2c64c 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1339,7 +1339,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,