kgdb: could not write to the last of valid memory with kgdb
[sfrench/cifs-2.6.git] / kernel / utsname.c
index 9d8180a0f0d815dbe051dbb6a710385d22f0b342..815237a55af8f277b43aea2c81471b9c05a4d00d 100644 (file)
@@ -12,8 +12,8 @@
 #include <linux/module.h>
 #include <linux/uts.h>
 #include <linux/utsname.h>
-#include <linux/version.h>
 #include <linux/err.h>
+#include <linux/slab.h>
 
 /*
  * Clone a new ns copying an original utsname, setting refcount to 1
@@ -28,7 +28,9 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns)
        if (!ns)
                return ERR_PTR(-ENOMEM);
 
+       down_read(&uts_sem);
        memcpy(&ns->name, &old_ns->name, sizeof(ns->name));
+       up_read(&uts_sem);
        kref_init(&ns->kref);
        return ns;
 }