summaryrefslogtreecommitdiffstats
path: root/kernel/user_namespace.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-11-16 23:20:58 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-04-07 17:11:46 -0700
commit7b44ab978b77a91b327058a0f4db7e6fcdb90b92 (patch)
tree632c872f0b88d001f1bddce2c0aacd77bf062454 /kernel/user_namespace.c
parent5673a94c14574d7c6495c320c6b0e480673d54bd (diff)
downloadlinux-stable-7b44ab978b77a91b327058a0f4db7e6fcdb90b92.tar.gz
linux-stable-7b44ab978b77a91b327058a0f4db7e6fcdb90b92.tar.bz2
linux-stable-7b44ab978b77a91b327058a0f4db7e6fcdb90b92.zip
userns: Disassociate user_struct from the user_namespace.
Modify alloc_uid to take a kuid and make the user hash table global. Stop holding a reference to the user namespace in struct user_struct. This simplifies the code and makes the per user accounting not care about which user namespace a uid happens to appear in. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r--kernel/user_namespace.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index e216e1e8ce84..898e973bd1e8 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -27,7 +27,6 @@ int create_user_ns(struct cred *new)
{
struct user_namespace *ns, *parent_ns = new->user_ns;
struct user_struct *root_user;
- int n;
ns = kmem_cache_alloc(user_ns_cachep, GFP_KERNEL);
if (!ns)
@@ -35,11 +34,8 @@ int create_user_ns(struct cred *new)
kref_init(&ns->kref);
- for (n = 0; n < UIDHASH_SZ; ++n)
- INIT_HLIST_HEAD(ns->uidhash_table + n);
-
/* Alloc new root user. */
- root_user = alloc_uid(ns, 0);
+ root_user = alloc_uid(make_kuid(ns, 0));
if (!root_user) {
kmem_cache_free(user_ns_cachep, ns);
return -ENOMEM;