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...)



 25-akpm/kernel/user.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN kernel/user.c~uidhash-locking kernel/user.c
--- 25/kernel/user.c~uidhash-locking	Mon Jul 28 12:10:48 2003
+++ 25-akpm/kernel/user.c	Mon Jul 28 12:10:48 2003
@@ -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;
 }
 

_