X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=kernel%2Futsname.c;h=64d398f1244436cbdc4ede981dd927e39ee708b5;hb=c21d1e7f53ffd9c0f162c42e7fde07d1c45fa127;hp=160c8c5136bd6a6607ccfae5cfc2e285fe5791c6;hpb=0b662c64840fb281e5948ab6f9d60f84817277d0;p=linux-2.6-omap-h63xx.git diff --git a/kernel/utsname.c b/kernel/utsname.c index 160c8c5136b..64d398f1244 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include /* * Clone a new ns copying an original utsname, setting refcount to 1 @@ -24,10 +26,13 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns) struct uts_namespace *ns; ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL); - if (ns) { - memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); - kref_init(&ns->kref); - } + 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; } @@ -37,7 +42,7 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns) * utsname of this process won't be seen by parent, and vice * versa. */ -struct uts_namespace *copy_utsname(int flags, struct uts_namespace *old_ns) +struct uts_namespace *copy_utsname(unsigned long flags, struct uts_namespace *old_ns) { struct uts_namespace *new_ns;