mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
random: crng_reseed() should lock the crng instance that it is modifying
commit0bb29a849aupstream. Reported-by: Jann Horn <jannh@google.com> Fixes:1e7f583af6("random: make /dev/urandom scalable for silly...") Cc: stable@kernel.org # 4.8+ Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jann Horn <jannh@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4dfb3442bb
commit
befd00cfc1
@@ -836,7 +836,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
|
||||
_crng_backtrack_protect(&primary_crng, buf.block,
|
||||
CHACHA20_KEY_SIZE);
|
||||
}
|
||||
spin_lock_irqsave(&primary_crng.lock, flags);
|
||||
spin_lock_irqsave(&crng->lock, flags);
|
||||
for (i = 0; i < 8; i++) {
|
||||
unsigned long rv;
|
||||
if (!arch_get_random_seed_long(&rv) &&
|
||||
@@ -852,7 +852,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
|
||||
wake_up_interruptible(&crng_init_wait);
|
||||
pr_notice("random: crng init done\n");
|
||||
}
|
||||
spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
spin_unlock_irqrestore(&crng->lock, flags);
|
||||
}
|
||||
|
||||
static inline void maybe_reseed_primary_crng(void)
|
||||
|
||||
Reference in New Issue
Block a user