The branch main has been updated by olce:

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

commit b7a87d7c0dd19016e82f5d33f2c5ec90479c31fe
Author:     Olivier Certner <o...@freebsd.org>
AuthorDate: 2025-08-28 15:47:38 +0000
Commit:     Olivier Certner <o...@freebsd.org>
CommitDate: 2025-09-17 12:16:04 +0000

    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
---
 sys/compat/linux/linux_misc.c | 3 +--
 1 file changed, 1 insertion(+), 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);

Reply via email to