forked from Minki/linux
kernel/groups.c: remove return value of set_groups
After commit 6307f8fee2
("security: remove dead hook task_setgroups"),
set_groups will always return zero, so we could just remove return value
of set_groups.
This patch reduces code size, and simplfies code to use set_groups,
because we don't need to check its return value any more.
[akpm@linux-foundation.org: remove obsolete claims from set_groups() comment]
Signed-off-by: Wang YanQing <udknight@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6af9f7bf3c
commit
8f6c5ffc89
@ -71,10 +71,8 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
|
|||||||
if (gid_eq(new->fsgid, INVALID_GID))
|
if (gid_eq(new->fsgid, INVALID_GID))
|
||||||
new->fsgid = exp->ex_anon_gid;
|
new->fsgid = exp->ex_anon_gid;
|
||||||
|
|
||||||
ret = set_groups(new, gi);
|
set_groups(new, gi);
|
||||||
put_group_info(gi);
|
put_group_info(gi);
|
||||||
if (ret < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!uid_eq(new->fsuid, GLOBAL_ROOT_UID))
|
if (!uid_eq(new->fsuid, GLOBAL_ROOT_UID))
|
||||||
new->cap_effective = cap_drop_nfsd_set(new->cap_effective);
|
new->cap_effective = cap_drop_nfsd_set(new->cap_effective);
|
||||||
@ -89,7 +87,6 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
|
|||||||
|
|
||||||
oom:
|
oom:
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
error:
|
|
||||||
abort_creds(new);
|
abort_creds(new);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ extern struct group_info *groups_alloc(int);
|
|||||||
extern struct group_info init_groups;
|
extern struct group_info init_groups;
|
||||||
extern void groups_free(struct group_info *);
|
extern void groups_free(struct group_info *);
|
||||||
extern int set_current_groups(struct group_info *);
|
extern int set_current_groups(struct group_info *);
|
||||||
extern int set_groups(struct cred *, struct group_info *);
|
extern void set_groups(struct cred *, struct group_info *);
|
||||||
extern int groups_search(const struct group_info *, kgid_t);
|
extern int groups_search(const struct group_info *, kgid_t);
|
||||||
|
|
||||||
/* access the groups "array" with this macro */
|
/* access the groups "array" with this macro */
|
||||||
|
@ -157,17 +157,13 @@ int groups_search(const struct group_info *group_info, kgid_t grp)
|
|||||||
* set_groups - Change a group subscription in a set of credentials
|
* set_groups - Change a group subscription in a set of credentials
|
||||||
* @new: The newly prepared set of credentials to alter
|
* @new: The newly prepared set of credentials to alter
|
||||||
* @group_info: The group list to install
|
* @group_info: The group list to install
|
||||||
*
|
|
||||||
* Validate a group subscription and, if valid, insert it into a set
|
|
||||||
* of credentials.
|
|
||||||
*/
|
*/
|
||||||
int set_groups(struct cred *new, struct group_info *group_info)
|
void set_groups(struct cred *new, struct group_info *group_info)
|
||||||
{
|
{
|
||||||
put_group_info(new->group_info);
|
put_group_info(new->group_info);
|
||||||
groups_sort(group_info);
|
groups_sort(group_info);
|
||||||
get_group_info(group_info);
|
get_group_info(group_info);
|
||||||
new->group_info = group_info;
|
new->group_info = group_info;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(set_groups);
|
EXPORT_SYMBOL(set_groups);
|
||||||
@ -182,18 +178,12 @@ EXPORT_SYMBOL(set_groups);
|
|||||||
int set_current_groups(struct group_info *group_info)
|
int set_current_groups(struct group_info *group_info)
|
||||||
{
|
{
|
||||||
struct cred *new;
|
struct cred *new;
|
||||||
int ret;
|
|
||||||
|
|
||||||
new = prepare_creds();
|
new = prepare_creds();
|
||||||
if (!new)
|
if (!new)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = set_groups(new, group_info);
|
set_groups(new, group_info);
|
||||||
if (ret < 0) {
|
|
||||||
abort_creds(new);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return commit_creds(new);
|
return commit_creds(new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user