diff options
Diffstat (limited to 'kernel/user.c')
-rw-r--r-- | kernel/user.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/user.c b/kernel/user.c index 0f3aa0234107..8320a87f3e5a 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -337,8 +337,11 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) | |||
337 | struct user_struct *new; | 337 | struct user_struct *new; |
338 | 338 | ||
339 | new = kmem_cache_alloc(uid_cachep, GFP_KERNEL); | 339 | new = kmem_cache_alloc(uid_cachep, GFP_KERNEL); |
340 | if (!new) | 340 | if (!new) { |
341 | uids_mutex_unlock(); | ||
341 | return NULL; | 342 | return NULL; |
343 | } | ||
344 | |||
342 | new->uid = uid; | 345 | new->uid = uid; |
343 | atomic_set(&new->__count, 1); | 346 | atomic_set(&new->__count, 1); |
344 | atomic_set(&new->processes, 0); | 347 | atomic_set(&new->processes, 0); |
@@ -355,6 +358,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) | |||
355 | 358 | ||
356 | if (alloc_uid_keyring(new, current) < 0) { | 359 | if (alloc_uid_keyring(new, current) < 0) { |
357 | kmem_cache_free(uid_cachep, new); | 360 | kmem_cache_free(uid_cachep, new); |
361 | uids_mutex_unlock(); | ||
358 | return NULL; | 362 | return NULL; |
359 | } | 363 | } |
360 | 364 | ||
@@ -362,6 +366,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) | |||
362 | key_put(new->uid_keyring); | 366 | key_put(new->uid_keyring); |
363 | key_put(new->session_keyring); | 367 | key_put(new->session_keyring); |
364 | kmem_cache_free(uid_cachep, new); | 368 | kmem_cache_free(uid_cachep, new); |
369 | uids_mutex_unlock(); | ||
365 | return NULL; | 370 | return NULL; |
366 | } | 371 | } |
367 | 372 | ||