Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7f05377 authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Greg Kroah-Hartman
Browse files

random: clamp credited irq bits to maximum mixed



commit e78a802a7b4febf53f2a92842f494b01062d85a8 upstream.

Since the most that's mixed into the pool is sizeof(long)*2, don't
credit more than that many bytes of entropy.

Fixes: e3e33fc2ea7f ("random: do not use input pool from hard IRQs")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f9597a30
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -976,7 +976,7 @@ static void mix_interrupt_randomness(struct work_struct *work)
	local_irq_enable();

	mix_pool_bytes(pool, sizeof(pool));
	credit_init_bits(max(1u, (count & U16_MAX) / 64));
	credit_init_bits(clamp_t(unsigned int, (count & U16_MAX) / 64, 1, sizeof(pool) * 8));

	memzero_explicit(pool, sizeof(pool));
}