aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 766467b3bcb7..8e1c8c0a496c 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -16,7 +16,6 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/user_namespace.h> 18#include <linux/user_namespace.h>
19#include "cred-internals.h"
20 19
21struct user_namespace init_user_ns = { 20struct user_namespace init_user_ns = {
22 .kref = { 21 .kref = {
@@ -137,9 +136,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
137 struct hlist_head *hashent = uidhashentry(ns, uid); 136 struct hlist_head *hashent = uidhashentry(ns, uid);
138 struct user_struct *up, *new; 137 struct user_struct *up, *new;
139 138
140 /* Make uid_hash_find() + uids_user_create() + uid_hash_insert() 139 /* Make uid_hash_find() + uid_hash_insert() atomic. */
141 * atomic.
142 */
143 spin_lock_irq(&uidhash_lock); 140 spin_lock_irq(&uidhash_lock);
144 up = uid_hash_find(uid, hashent); 141 up = uid_hash_find(uid, hashent);
145 spin_unlock_irq(&uidhash_lock); 142 spin_unlock_irq(&uidhash_lock);
@@ -161,11 +158,6 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
161 spin_lock_irq(&uidhash_lock); 158 spin_lock_irq(&uidhash_lock);
162 up = uid_hash_find(uid, hashent); 159 up = uid_hash_find(uid, hashent);
163 if (up) { 160 if (up) {
164 /* This case is not possible when CONFIG_USER_SCHED
165 * is defined, since we serialize alloc_uid() using
166 * uids_mutex. Hence no need to call
167 * sched_destroy_user() or remove_user_sysfs_dir().
168 */
169 key_put(new->uid_keyring); 161 key_put(new->uid_keyring);
170 key_put(new->session_keyring); 162 key_put(new->session_keyring);
171 kmem_cache_free(uid_cachep, new); 163 kmem_cache_free(uid_cachep, new);
@@ -178,8 +170,6 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
178 170
179 return up; 171 return up;
180 172
181 put_user_ns(new->user_ns);
182 kmem_cache_free(uid_cachep, new);
183out_unlock: 173out_unlock:
184 return NULL; 174 return NULL;
185} 175}