random: Plug race in preceding patch

The lockless get_random_uXX() routines locklessly read the next value
from the respective linear buffer and then overwrite it with a 0x0
value. This is racy, as the code might be re-entered by an interrupt
handler, and so the store might redundantly wipe the location accessed
by the interrupt context rather than the interrupted context.

To plug this race, wipe the preceding location when reading the next
value from the linear buffer. Given that the position is always non-zero
outside of the critical section, this is guaranteed to be safe, and
ensures that the produced values are always wiped from the buffer.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 file changed