Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random

Pull random fixes from Ted Ts'o:
"Fix some locking and gcc optimization issues from the most recent
random_for_linus_stable pull request"

* tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
random: silence compiler warnings and fix race

+6 -6
+6 -6
drivers/char/random.c
··· 803 803 p[crng_init_cnt % CHACHA20_KEY_SIZE] ^= *cp; 804 804 cp++; crng_init_cnt++; len--; 805 805 } 806 + spin_unlock_irqrestore(&primary_crng.lock, flags); 806 807 if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { 807 808 invalidate_batched_entropy(); 808 809 crng_init = 1; 809 810 wake_up_interruptible(&crng_init_wait); 810 811 pr_notice("random: fast init done\n"); 811 812 } 812 - spin_unlock_irqrestore(&primary_crng.lock, flags); 813 813 return 1; 814 814 } 815 815 ··· 841 841 } 842 842 memzero_explicit(&buf, sizeof(buf)); 843 843 crng->init_time = jiffies; 844 + spin_unlock_irqrestore(&primary_crng.lock, flags); 844 845 if (crng == &primary_crng && crng_init < 2) { 845 846 invalidate_batched_entropy(); 846 847 crng_init = 2; ··· 849 848 wake_up_interruptible(&crng_init_wait); 850 849 pr_notice("random: crng init done\n"); 851 850 } 852 - spin_unlock_irqrestore(&primary_crng.lock, flags); 853 851 } 854 852 855 853 static inline void crng_wait_ready(void) ··· 2041 2041 u64 get_random_u64(void) 2042 2042 { 2043 2043 u64 ret; 2044 - bool use_lock = crng_init < 2; 2045 - unsigned long flags; 2044 + bool use_lock = READ_ONCE(crng_init) < 2; 2045 + unsigned long flags = 0; 2046 2046 struct batched_entropy *batch; 2047 2047 2048 2048 #if BITS_PER_LONG == 64 ··· 2073 2073 u32 get_random_u32(void) 2074 2074 { 2075 2075 u32 ret; 2076 - bool use_lock = crng_init < 2; 2077 - unsigned long flags; 2076 + bool use_lock = READ_ONCE(crng_init) < 2; 2077 + unsigned long flags = 0; 2078 2078 struct batched_entropy *batch; 2079 2079 2080 2080 if (arch_get_random_int(&ret))