Files
linux-stable-mirror/crypto
Haixin Xu 18216b8ab6 crypto: jitterentropy - replace long-held spinlock with mutex
[ Upstream commit 01d798e9fe ]

jent_kcapi_random() serializes the shared jitterentropy state, but it
currently holds a spinlock across the jent_read_entropy() call. That
path performs expensive jitter collection and SHA3 conditioning, so
parallel readers can trigger stalls as contending waiters spin for
the same lock.

To prevent non-preemptible lock hold, replace rng->jent_lock with a
mutex so contended readers sleep instead of spinning on a shared lock
held across expensive entropy generation.

Fixes: bb5530e408 ("crypto: jitterentropy - add jitterentropy RNG")
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Yuan Tan <yuantan098@gmail.com>
Suggested-by: Xin Liu <bird@lzu.edu.cn>
Signed-off-by: Haixin Xu <jerryxucs@gmail.com>
Reviewed-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-05-23 13:03:15 +02:00
..
2023-06-23 16:15:36 +08:00
2023-05-24 18:12:33 +08:00
2023-06-16 20:30:35 +08:00
2023-06-27 15:40:24 +08:00
2023-02-14 13:39:33 +08:00
2024-10-04 16:28:49 +02:00