]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] uidhash init-time locking
authorAndrew Morton <akpm@osdl.org>
Fri, 1 Aug 2003 03:10:03 +0000 (20:10 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 1 Aug 2003 03:10:03 +0000 (20:10 -0700)
From: <ffrederick@prov-liege.be>

Add the necessary locking around uid_hash_insert() in uid_cache_init().

(It's an initcall, and the chances of another CPU racing with us here are
basically zero.  But it's good for documentary purposes and the code gets
dropped later anyway...)

kernel/user.c

index 86bd412b85dafebcf7ea4a5c80d07b08c0c22f80..f5c9d425a783979326fee61eb0b3e47eedf202f8 100644 (file)
@@ -146,8 +146,11 @@ static int __init uid_cache_init(void)
        for(n = 0; n < UIDHASH_SZ; ++n)
                INIT_LIST_HEAD(uidhash_table + n);
 
-       /* Insert the root user immediately - init already runs with this */
+       /* Insert the root user immediately (init already runs as root) */
+       spin_lock(&uidhash_lock);
        uid_hash_insert(&root_user, uidhashentry(0));
+       spin_unlock(&uidhash_lock);
+
        return 0;
 }