This function does not need to lock the input pool during the hash since that only reads the pool & we do not care if a write makes the hash result indeterminate. "That's not a bug; it's a feature." Removing the unnecessary lock prevents it from delaying other threads or interrupts which write to the input pool. Such delays are a bug. We do need to lock the input pool when writing to it. Changing __mix_pool_bytes() to plain mix_pool_bytes() accomplishes that. We do not need a lock for *out, the only other place where this function writes. That points to an array declared local in the calling function. --- drivers/char/random.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 68613f0b6887..9dbf7c8c68dd 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1355,7 +1355,6 @@ static void extract_buf(u8 *out) } /* Generate a hash across the pool */ - spin_lock_irqsave(&input_pool.lock, flags); blake2s_update(&state, (const u8 *)input_pool_data, POOL_BYTES); blake2s_final(&state, hash); /* final zeros out state */ @@ -1368,8 +1367,7 @@ static void extract_buf(u8 *out) * brute-forcing the feedback as hard as brute-forcing the * hash. */ - __mix_pool_bytes(hash, sizeof(hash)); - spin_unlock_irqrestore(&input_pool.lock, flags); + mix_pool_bytes(hash, sizeof(hash)); /* Note that EXTRACT_SIZE is half of hash size here, because above * we've dumped the full length back into mixer. By reducing the -- Signed-off-by: Sandy Harris <sandyinchina@xxxxxxxxx>