diff options
-rw-r--r-- | drivers/char/random.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 7f5271272f91..397c714cf2ba 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -693,9 +693,14 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes) | |||
693 | 693 | ||
694 | if (r->pull && r->entropy_count < nbytes * 8 && | 694 | if (r->pull && r->entropy_count < nbytes * 8 && |
695 | r->entropy_count < r->poolinfo->POOLBITS) { | 695 | r->entropy_count < r->poolinfo->POOLBITS) { |
696 | int bytes = max_t(int, random_read_wakeup_thresh / 8, | 696 | /* If we're limited, always leave two wakeup worth's BITS */ |
697 | min_t(int, nbytes, sizeof(tmp))); | ||
698 | int rsvd = r->limit ? 0 : random_read_wakeup_thresh/4; | 697 | int rsvd = r->limit ? 0 : random_read_wakeup_thresh/4; |
698 | int bytes = nbytes; | ||
699 | |||
700 | /* pull at least as many as BYTES as wakeup BITS */ | ||
701 | bytes = max_t(int, bytes, random_read_wakeup_thresh / 8); | ||
702 | /* but never more than the buffer size */ | ||
703 | bytes = min_t(int, bytes, sizeof(tmp)); | ||
699 | 704 | ||
700 | DEBUG_ENT("going to reseed %s with %d bits " | 705 | DEBUG_ENT("going to reseed %s with %d bits " |
701 | "(%d of %d requested)\n", | 706 | "(%d of %d requested)\n", |