array represent a valid PAG (perhaps because they weren't zeroed), then
set_pag_in_parent won't add 2 to ngroups and the parent process won't
join the PAG.
(cherry picked from commit
f5e96f747edc8674b6bf529b9c88d07799d9b10c)
gp = current->p_pptr->groups;
- if (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG) {
+ if ((ngroups < 2) || (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG)) {
/* We will have to shift grouplist to make room for pag */
if (ngroups + 2 > NGROUPS) {
return EINVAL;