Skip to content

Commit 8973e07

Browse files
tytsogregkh
authored andcommitted
random: run random_int_secret_init() run after all late_initcalls
commit 47d06e5 upstream. The some platforms (e.g., ARM) initializes their clocks as late_initcalls for some unknown reason. So make sure random_int_secret_init() is run after all of the late_initcalls are run. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8bbe4d2 commit 8973e07

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/char/random.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,12 +1462,11 @@ struct ctl_table random_table[] = {
14621462

14631463
static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned;
14641464

1465-
static int __init random_int_secret_init(void)
1465+
int random_int_secret_init(void)
14661466
{
14671467
get_random_bytes(random_int_secret, sizeof(random_int_secret));
14681468
return 0;
14691469
}
1470-
late_initcall(random_int_secret_init);
14711470

14721471
/*
14731472
* Get a random word for internal kernel use only. Similar to urandom but

‎include/linux/random.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags);
1717
extern void get_random_bytes(void *buf, int nbytes);
1818
extern void get_random_bytes_arch(void *buf, int nbytes);
1919
void generate_random_uuid(unsigned char uuid_out[16]);
20+
extern int random_int_secret_init(void);
2021

2122
#ifndef MODULE
2223
extern const struct file_operations random_fops, urandom_fops;

‎init/main.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include <linux/blkdev.h>
7676
#include <linux/elevator.h>
7777
#include <linux/sched_clock.h>
78+
#include <linux/random.h>
7879

7980
#include <asm/io.h>
8081
#include <asm/bugs.h>
@@ -778,6 +779,7 @@ static void __init do_basic_setup(void)
778779
do_ctors();
779780
usermodehelper_enable();
780781
do_initcalls();
782+
random_int_secret_init();
781783
}
782784

783785
static void __init do_pre_smp_initcalls(void)

0 commit comments

Comments
 (0)