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:          9da2fe96ff ("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
This commit is contained in:
Olivier Certner
2025-08-28 18:58:53 +02:00
parent a207833f4f
commit bbdea7c9f4
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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));
+1 -1
View File
@@ -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));