]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.11.6/random-run-random_int_secret_init-run-after-all-late_initcalls.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.11.6 / random-run-random_int_secret_init-run-after-all-late_initcalls.patch
1 From 47d06e532e95b71c0db3839ebdef3fe8812fca2c Mon Sep 17 00:00:00 2001
2 From: Theodore Ts'o <tytso@mit.edu>
3 Date: Tue, 10 Sep 2013 10:52:35 -0400
4 Subject: random: run random_int_secret_init() run after all late_initcalls
5
6 From: Theodore Ts'o <tytso@mit.edu>
7
8 commit 47d06e532e95b71c0db3839ebdef3fe8812fca2c upstream.
9
10 The some platforms (e.g., ARM) initializes their clocks as
11 late_initcalls for some unknown reason. So make sure
12 random_int_secret_init() is run after all of the late_initcalls are
13 run.
14
15 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/char/random.c | 3 +--
20 include/linux/random.h | 1 +
21 init/main.c | 2 ++
22 3 files changed, 4 insertions(+), 2 deletions(-)
23
24 --- a/drivers/char/random.c
25 +++ b/drivers/char/random.c
26 @@ -1462,12 +1462,11 @@ struct ctl_table random_table[] = {
27
28 static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned;
29
30 -static int __init random_int_secret_init(void)
31 +int random_int_secret_init(void)
32 {
33 get_random_bytes(random_int_secret, sizeof(random_int_secret));
34 return 0;
35 }
36 -late_initcall(random_int_secret_init);
37
38 /*
39 * Get a random word for internal kernel use only. Similar to urandom but
40 --- a/include/linux/random.h
41 +++ b/include/linux/random.h
42 @@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int
43 extern void get_random_bytes(void *buf, int nbytes);
44 extern void get_random_bytes_arch(void *buf, int nbytes);
45 void generate_random_uuid(unsigned char uuid_out[16]);
46 +extern int random_int_secret_init(void);
47
48 #ifndef MODULE
49 extern const struct file_operations random_fops, urandom_fops;
50 --- a/init/main.c
51 +++ b/init/main.c
52 @@ -75,6 +75,7 @@
53 #include <linux/blkdev.h>
54 #include <linux/elevator.h>
55 #include <linux/sched_clock.h>
56 +#include <linux/random.h>
57
58 #include <asm/io.h>
59 #include <asm/bugs.h>
60 @@ -778,6 +779,7 @@ static void __init do_basic_setup(void)
61 do_ctors();
62 usermodehelper_enable();
63 do_initcalls();
64 + random_int_secret_init();
65 }
66
67 static void __init do_pre_smp_initcalls(void)