aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorWang YanQing <udknight@gmail.com>2014-04-03 17:48:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:21:05 -0400
commit8f6c5ffc8987f4f5b5a3e9d557d94bbf3a9bf216 (patch)
tree79ea014021610d9a6057c070e1208542fd014e33 /kernel
parent6af9f7bf3c399e0ab1eee048e13572c6d4e15fe9 (diff)
kernel/groups.c: remove return value of set_groups
After commit 6307f8fee295 ("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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/groups.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/kernel/groups.c b/kernel/groups.c
index 90cf1c38c8ea..451698f86cfa 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -157,17 +157,13 @@ int groups_search(const struct group_info *group_info, kgid_t grp)
157 * set_groups - Change a group subscription in a set of credentials 157 * set_groups - Change a group subscription in a set of credentials
158 * @new: The newly prepared set of credentials to alter 158 * @new: The newly prepared set of credentials to alter
159 * @group_info: The group list to install 159 * @group_info: The group list to install
160 *
161 * Validate a group subscription and, if valid, insert it into a set
162 * of credentials.
163 */ 160 */
164int set_groups(struct cred *new, struct group_info *group_info) 161void set_groups(struct cred *new, struct group_info *group_info)
165{ 162{
166 put_group_info(new->group_info); 163 put_group_info(new->group_info);
167 groups_sort(group_info); 164 groups_sort(group_info);
168 get_group_info(group_info); 165 get_group_info(group_info);
169 new->group_info = group_info; 166 new->group_info = group_info;
170 return 0;
171} 167}
172 168
173EXPORT_SYMBOL(set_groups); 169EXPORT_SYMBOL(set_groups);
@@ -182,18 +178,12 @@ EXPORT_SYMBOL(set_groups);
182int set_current_groups(struct group_info *group_info) 178int set_current_groups(struct group_info *group_info)
183{ 179{
184 struct cred *new; 180 struct cred *new;
185 int ret;
186 181
187 new = prepare_creds(); 182 new = prepare_creds();
188 if (!new) 183 if (!new)
189 return -ENOMEM; 184 return -ENOMEM;
190 185
191 ret = set_groups(new, group_info); 186 set_groups(new, group_info);
192 if (ret < 0) {
193 abort_creds(new);
194 return ret;
195 }
196
197 return commit_creds(new); 187 return commit_creds(new);
198} 188}
199 189