Commit 47f7edc1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] uidhash init-time locking

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...)
parent cbc8594c
...@@ -146,8 +146,11 @@ static int __init uid_cache_init(void) ...@@ -146,8 +146,11 @@ static int __init uid_cache_init(void)
for(n = 0; n < UIDHASH_SZ; ++n) for(n = 0; n < UIDHASH_SZ; ++n)
INIT_LIST_HEAD(uidhash_table + 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)); uid_hash_insert(&root_user, uidhashentry(0));
spin_unlock(&uidhash_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment