aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2025-08-28 15:47:38 +0000
committerOlivier Certner <olce@FreeBSD.org>2025-09-17 12:16:04 +0000
commitb7a87d7c0dd19016e82f5d33f2c5ec90479c31fe (patch)
tree45eb4c90f4881a7c6621a6517c9af122b69f56ac
parentbbdea7c9f4aeae26b35f842382df0203fcda24a5 (diff)
linux: setgroups(): Avoid allocation under the process lock
This was missed in commit 838d9858251e ("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
-rw-r--r--sys/compat/linux/linux_misc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index fb86de6e7302..0925ffb64480 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -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);