aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/utsname.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/utsname.c')
-rw-r--r--kernel/utsname.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 8a82b4b8ea52..a7b3a8d1ad24 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -14,6 +14,7 @@
14#include <linux/utsname.h> 14#include <linux/utsname.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/user_namespace.h>
17 18
18static struct uts_namespace *create_uts_ns(void) 19static struct uts_namespace *create_uts_ns(void)
19{ 20{
@@ -40,6 +41,8 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns)
40 41
41 down_read(&uts_sem); 42 down_read(&uts_sem);
42 memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); 43 memcpy(&ns->name, &old_ns->name, sizeof(ns->name));
44 ns->user_ns = old_ns->user_ns;
45 get_user_ns(ns->user_ns);
43 up_read(&uts_sem); 46 up_read(&uts_sem);
44 return ns; 47 return ns;
45} 48}
@@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
71 struct uts_namespace *ns; 74 struct uts_namespace *ns;
72 75
73 ns = container_of(kref, struct uts_namespace, kref); 76 ns = container_of(kref, struct uts_namespace, kref);
77 put_user_ns(ns->user_ns);
74 kfree(ns); 78 kfree(ns);
75} 79}