diff options
-rw-r--r-- | drivers/char/random.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index f126bd2f69fe..62923138e77a 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -761,6 +761,7 @@ static struct timer_rand_state input_timer_state; | |||
761 | */ | 761 | */ |
762 | static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | 762 | static void add_timer_randomness(struct timer_rand_state *state, unsigned num) |
763 | { | 763 | { |
764 | struct entropy_store *r; | ||
764 | struct { | 765 | struct { |
765 | long jiffies; | 766 | long jiffies; |
766 | unsigned cycles; | 767 | unsigned cycles; |
@@ -773,7 +774,8 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | |||
773 | sample.jiffies = jiffies; | 774 | sample.jiffies = jiffies; |
774 | sample.cycles = random_get_entropy(); | 775 | sample.cycles = random_get_entropy(); |
775 | sample.num = num; | 776 | sample.num = num; |
776 | mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL); | 777 | r = nonblocking_pool.initialized ? &input_pool : &nonblocking_pool; |
778 | mix_pool_bytes(r, &sample, sizeof(sample), NULL); | ||
777 | 779 | ||
778 | /* | 780 | /* |
779 | * Calculate number of bits of randomness we probably added. | 781 | * Calculate number of bits of randomness we probably added. |
@@ -807,8 +809,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | |||
807 | * Round down by 1 bit on general principles, | 809 | * Round down by 1 bit on general principles, |
808 | * and limit entropy entimate to 12 bits. | 810 | * and limit entropy entimate to 12 bits. |
809 | */ | 811 | */ |
810 | credit_entropy_bits(&input_pool, | 812 | credit_entropy_bits(r, min_t(int, fls(delta>>1), 11)); |
811 | min_t(int, fls(delta>>1), 11)); | ||
812 | } | 813 | } |
813 | preempt_enable(); | 814 | preempt_enable(); |
814 | } | 815 | } |