Skip to content

Commit 9fe68ca

Browse files
committed
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu: "This fixes a regression caused by the stack vmalloc change" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: hwrng: core - Don't use a stack buffer in add_early_randomness()
2 parents b5cd891 + 6d4952d commit 9fe68ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/char/hw_random/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ static size_t rng_buffer_size(void)
8484

8585
static void add_early_randomness(struct hwrng *rng)
8686
{
87-
unsigned char bytes[16];
8887
int bytes_read;
88+
size_t size = min_t(size_t, 16, rng_buffer_size());
8989

9090
mutex_lock(&reading_mutex);
91-
bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
91+
bytes_read = rng_get_data(rng, rng_buffer, size, 1);
9292
mutex_unlock(&reading_mutex);
9393
if (bytes_read > 0)
94-
add_device_randomness(bytes, bytes_read);
94+
add_device_randomness(rng_buffer, bytes_read);
9595
}
9696

9797
static inline void cleanup_rng(struct kref *kref)

0 commit comments

Comments
 (0)