linux: setgroups(): Avoid allocation under the process lock

This was missed in commit 838d985825 ("Rework the credential code to
support larger values of NGROUPS (...)").

No functional change (intended).

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52278
This commit is contained in:
Olivier Certner
2025-08-28 17:47:38 +02:00
parent bbdea7c9f4
commit b7a87d7c0d
+1 -2
View File
@@ -1045,8 +1045,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
crextend(newcred, ngrp);
p = td->td_proc;
PROC_LOCK(p);
oldcred = p->p_ucred;
crcopy(newcred, oldcred);
oldcred = crcopysafe(p, newcred);
if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS)) != 0) {
PROC_UNLOCK(p);