aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-02-23 18:23:55 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-23 20:12:15 -0500
commit3e4ab747efa8e78562ec6782b08bbf21a00aba1b (patch)
tree755b76c9f382a808c718a0289193602038b14c9b /kernel/futex.c
parent43fe105a5c91b2f00ea7f900ed307fe980410612 (diff)
futex: fix init order
When the futex init code fails to initialize the futex pseudo file system it returns early without initializing the hash queues. Should the boot succeed then a futex syscall which tries to enqueue a waiter on the hashqueue will crash due to the unitilialized plist heads. Initialize the hash queues before the filesystem. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Lennert Buytenhek <buytenh@wantstofly.org> Cc: Riku Voipio <riku.voipio@movial.fi> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 221f2128a437..c21f667c63f6 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2145,8 +2145,14 @@ static struct file_system_type futex_fs_type = {
2145 2145
2146static int __init init(void) 2146static int __init init(void)
2147{ 2147{
2148 int i = register_filesystem(&futex_fs_type); 2148 int i;
2149 2149
2150 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2151 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2152 spin_lock_init(&futex_queues[i].lock);
2153 }
2154
2155 i = register_filesystem(&futex_fs_type);
2150 if (i) 2156 if (i)
2151 return i; 2157 return i;
2152 2158
@@ -2156,10 +2162,6 @@ static int __init init(void)
2156 return PTR_ERR(futex_mnt); 2162 return PTR_ERR(futex_mnt);
2157 } 2163 }
2158 2164
2159 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2160 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2161 spin_lock_init(&futex_queues[i].lock);
2162 }
2163 return 0; 2165 return 0;
2164} 2166}
2165__initcall(init); 2167__initcall(init);