From 8a5db48f62a8ae42cc13c4aaca2a89faa798aa4d Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Sun, 3 Apr 2005 20:49:20 +0000 Subject: [PATCH] STABLE14-more-linux26-cred-fixes-20050403 FIXES 18009 instead of crget() getting a groups_alloc(0) just to put it, we just fix crref()/crdup()/afs_pioctl() to do the "right" thing added missing task_lock()'s as well. (cherry picked from commit becb3ea3ce793972f95523a3efd88f8c43837675) --- src/afs/LINUX/osi_cred.c | 25 +++++++++---------------- src/afs/afs_pioctl.c | 3 +++ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c index 6795d3f57..a8f806c56 100644 --- a/src/afs/LINUX/osi_cred.c +++ b/src/afs/LINUX/osi_cred.c @@ -63,9 +63,6 @@ crget(void) CRED_UNLOCK(); memset(tmp, 0, sizeof(cred_t)); -#if defined(AFS_LINUX26_ENV) - tmp->cr_group_info = groups_alloc(0); -#endif tmp->cr_ref = 1; return tmp; } @@ -98,15 +95,10 @@ crdup(cred_t * cr) tmp->cr_uid = cr->cr_uid; tmp->cr_ruid = cr->cr_ruid; tmp->cr_gid = cr->cr_gid; -#if defined(AFS_LINUX26_ENV) -{ - struct group_info *old_info; - old_info = tmp->cr_group_info; +#if defined(AFS_LINUX26_ENV) get_group_info(cr->cr_group_info); tmp->cr_group_info = cr->cr_group_info; - put_group_info(old_info); -} #else memcpy(tmp->cr_groups, cr->cr_groups, NGROUPS * sizeof(gid_t)); tmp->cr_ngroups = cr->cr_ngroups; @@ -125,15 +117,12 @@ crref(void) cr->cr_ruid = current->uid; cr->cr_gid = current->fsgid; cr->cr_rgid = current->gid; -#if defined(AFS_LINUX26_ENV) -{ - struct group_info *old_info; - old_info = cr->cr_group_info; +#if defined(AFS_LINUX26_ENV) + task_lock(current); get_group_info(current->group_info); cr->cr_group_info = current->group_info; - put_group_info(old_info); -} + task_unlock(current); #else memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t)); cr->cr_ngroups = current->ngroups; @@ -155,9 +144,13 @@ crset(cred_t * cr) struct group_info *old_info; /* using set_current_groups() will sort the groups */ - old_info = current->group_info; get_group_info(cr->cr_group_info); + + task_lock(current); + old_info = current->group_info; current->group_info = cr->cr_group_info; + task_unlock(current); + put_group_info(old_info); } #else diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 6b508d5fa..2523b70e1 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -3326,6 +3326,9 @@ HandleClientContext(struct afs_ioctl *ablob, int *com, uid = afs_nobody; /* NFS_NOBODY == -2 */ } newcred = crget(); +#if defined(AFS_LINUX26_ENV) + newcred->cr_group_info = groups_alloc(0); +#endif #ifdef AFS_AIX41_ENV setuerror(0); #endif -- 2.39.5