Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e4ab747 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Linus Torvalds
Browse files

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: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Riku Voipio <riku.voipio@movial.fi>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 43fe105a
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -2145,8 +2145,14 @@ static struct file_system_type futex_fs_type = {


static int __init init(void)
static int __init init(void)
{
{
	int i = register_filesystem(&futex_fs_type);
	int i;


	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
		spin_lock_init(&futex_queues[i].lock);
	}

	i = register_filesystem(&futex_fs_type);
	if (i)
	if (i)
		return i;
		return i;


@@ -2156,10 +2162,6 @@ static int __init init(void)
		return PTR_ERR(futex_mnt);
		return PTR_ERR(futex_mnt);
	}
	}


	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
		plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
		spin_lock_init(&futex_queues[i].lock);
	}
	return 0;
	return 0;
}
}
__initcall(init);
__initcall(init);