summaryrefslogtreecommitdiffstats
path: root/kernel/groups.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-09 09:09:39 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-05-03 03:29:33 -0700
commit72cda3d1ef24ab0a9a89c15e9776ca737b75f45a (patch)
tree91f91efb04ff8afd01f840666cc0cdc61d9c1b17 /kernel/groups.c
parent92361636e0153bd0cb22e7dfe3fc6287f6537c66 (diff)
downloadlinux-72cda3d1ef24ab0a9a89c15e9776ca737b75f45a.tar.bz2
userns: Convert in_group_p and in_egroup_p to use kgid_t
Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/groups.c')
-rw-r--r--kernel/groups.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/groups.c b/kernel/groups.c
index 84156f2d4c8c..6b2588dd04ff 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -256,27 +256,25 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
/*
* Check whether we're fsgid/egid or in the supplemental group..
*/
-int in_group_p(gid_t grp)
+int in_group_p(kgid_t grp)
{
const struct cred *cred = current_cred();
int retval = 1;
- if (grp != cred->fsgid)
- retval = groups_search(cred->group_info,
- make_kgid(cred->user_ns, grp));
+ if (!gid_eq(grp, cred->fsgid))
+ retval = groups_search(cred->group_info, grp);
return retval;
}
EXPORT_SYMBOL(in_group_p);
-int in_egroup_p(gid_t grp)
+int in_egroup_p(kgid_t grp)
{
const struct cred *cred = current_cred();
int retval = 1;
- if (grp != cred->egid)
- retval = groups_search(cred->group_info,
- make_kgid(cred->user_ns, grp));
+ if (!gid_eq(grp, cred->egid))
+ retval = groups_search(cred->group_info, grp);
return retval;
}