Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.24-rc3-git7 /kernel/user.c

Filename:/kernel/user.c
Lines Added:6
Lines Deleted:1
Also changed in: (Previous) 2.6.24-rc3-git6  2.6.24-rc3-git5  2.6.24-rc3-git4  2.6.24-rc3-git3  2.6.24-rc3-git2  2.6.24-rc3 
(Following) 2.6.24-rc4  2.6.24-rc5  2.6.24-rc6  2.6.24-rc7  2.6.24-rc8  2.6.24 

Location
[  2.6.24-rc3-git7
  [  kernel
     o  user.c

Patch

diff --git a/kernel/user.c b/kernel/user.c
index 0f3aa02..8320a87 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)
       struct user_struct *new;
 
       new = kmem_cache_alloc(uid_cachep, GFP_KERNEL);
-      if (!new)
+      if (!new) {
+         uids_mutex_unlock();
          return NULL;
+      }
+
       new->uid = uid;
       atomic_set(&new->__count, 1);
       atomic_set(&new->processes, 0);
@@ -355,6 +358,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
 
       if (alloc_uid_keyring(new, current) < 0) {
          kmem_cache_free(uid_cachep, new);
+         uids_mutex_unlock();
          return NULL;
       }
 
@@ -362,6 +366,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
          key_put(new->uid_keyring);
          key_put(new->session_keyring);
          kmem_cache_free(uid_cachep, new);
+         uids_mutex_unlock();
          return NULL;
       }
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.