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.

hwrng: core - use rng_fillbuf in add_early_randomness()

Using rng_buffer in add_early_randomness() may race with rng_dev_read().
Use rng_fillbuf instead, as it is otherwise only used within the kernel
by hwrng_fillfn() and therefore never exposed to userspace.

Cc: Matt Mackall <mpm@selenic.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Dominik Brodowski and committed by
Herbert Xu
c05ac449 6ff63044

+2 -2
+2 -2
drivers/char/hw_random/core.c
··· 66 66 int bytes_read; 67 67 68 68 mutex_lock(&reading_mutex); 69 - bytes_read = rng_get_data(rng, rng_buffer, 32, 0); 69 + bytes_read = rng_get_data(rng, rng_fillbuf, 32, 0); 70 70 mutex_unlock(&reading_mutex); 71 71 if (bytes_read > 0) 72 - add_device_randomness(rng_buffer, bytes_read); 72 + add_device_randomness(rng_fillbuf, bytes_read); 73 73 } 74 74 75 75 static inline void cleanup_rng(struct kref *kref)