The branch stable/15 has been updated by olce:

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

commit 469c3a4139fe85b092734b0af9dbc167a8ebbf1e
Author:     Olivier Certner <[email protected]>
AuthorDate: 2025-08-28 16:58:53 +0000
Commit:     Olivier Certner <[email protected]>
CommitDate: 2025-09-23 12:02:44 +0000

    linux: setgroups(): Fix the group number's upper limit
    
    'ngroups_max' is the maximum number of supplementary groups the system
    will accept, and this has not changed.
    
    Fixes:          9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to 
match other platforms")
    MFC after:      5 days
    MFC to:         stable/15
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52277
    
    (cherry picked from commit bbdea7c9f4aeae26b35f842382df0203fcda24a5)
---
 sys/compat/linux/linux_misc.c  | 2 +-
 sys/compat/linux/linux_uid16.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 755eae057406..fb86de6e7302 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1034,7 +1034,7 @@ linux_setgroups(struct thread *td, struct 
linux_setgroups_args *args)
        int error;
        struct proc *p;
 
-       if (ngrp < 0 || ngrp >= ngroups_max)
+       if (ngrp < 0 || ngrp > ngroups_max)
                return (EINVAL);
        linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
        error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index 07430f5b399b..dd681f971746 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -91,7 +91,7 @@ linux_setgroups16(struct thread *td, struct 
linux_setgroups16_args *args)
        int error;
        struct proc *p;
 
-       if (ngrp < 0 || ngrp >= ngroups_max)
+       if (ngrp < 0 || ngrp > ngroups_max)
                return (EINVAL);
        linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
        error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));

Reply via email to