Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=efc63c4fb0f95865907472d1c6bc0cfea9ee156b
Commit:     efc63c4fb0f95865907472d1c6bc0cfea9ee156b
Parent:     019ad4a0a60b09022945273848b5a686e39a78aa
Author:     Alexey Dobriyan <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 18 22:46:27 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Sep 19 11:24:17 2007 -0700

    Fix UTS corruption during clone(CLONE_NEWUTS)
    
    struct utsname is copied from master one without any exclusion.
    
    Here is sample output from one proggie doing
    
        sethostname("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
        sethostname("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
    
    and another
    
        clone(,, CLONE_NEWUTS, ...)
        uname()
    
        hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaabbbbb'
        hostname = 'bbbaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        hostname = 'aaaaaaaabbbbbbbbbbbbbbbbbbbbbb'
        hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaabbbb'
        hostname = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaabb'
        hostname = 'aaabbbbbbbbbbbbbbbbbbbbbbbbbbb'
        hostname = 'bbbbbbbbbbbbbbbbaaaaaaaaaaaaaa'
    
    Hostname is sometimes corrupted.
    
    Yes, even _the_ simplest namespace activity had bug in it. :-(
    
    Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
    Acked-by: Serge Hallyn <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/utsname.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/utsname.c b/kernel/utsname.c
index 9d8180a..816d7b2 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -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;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to