git: db27bce904be - stable/15 - linux: setgroups16(): Pre-extend the groups array

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 23 Sep 2025 12:03:42 UTC
The branch stable/15 has been updated by olce:

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

commit db27bce904befe71052372545e6e111075dcc801
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-28 16:27:30 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-23 12:02:45 +0000

    linux: setgroups16(): Pre-extend the groups array
    
    For the size we know we will need in the end.
    
    No functional change (intended).
    
    MFC after:      5 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52279
    
    (cherry picked from commit b1326edddb302a28fc9418ab60df6210513cc07c)
---
 sys/compat/linux/linux_uid16.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index dd681f971746..8ac093e004d0 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -102,6 +102,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
 	}
 
 	newcred = crget();
+	crextend(newcred, ngrp);
 	p = td->td_proc;
 	PROC_LOCK(p);
 	oldcred = crcopysafe(p, newcred);