aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-06-10 23:18:16 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-07-15 04:49:39 -0400
commitcff850312cc7c0e0b9fe8b573687812dea232031 (patch)
tree6498e87fd912d2f90905a8bd71a602930fd9905e /drivers
parent85608f8e16c28f818f6bb9918958d231afa8bec2 (diff)
random: only update the last_pulled time if we actually transferred entropy
In xfer_secondary_pull(), check to make sure we need to pull from the secondary pool before checking and potentially updating the last_pulled time. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: George Spelvin <linux@horizon.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/random.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index bc0de22f31f4..364a8001a2bd 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -920,6 +920,11 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
920static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes); 920static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes);
921static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes) 921static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
922{ 922{
923 if (!r->pull ||
924 r->entropy_count >= (nbytes << (ENTROPY_SHIFT + 3)) ||
925 r->entropy_count > r->poolinfo->poolfracbits)
926 return;
927
923 if (r->limit == 0 && random_min_urandom_seed) { 928 if (r->limit == 0 && random_min_urandom_seed) {
924 unsigned long now = jiffies; 929 unsigned long now = jiffies;
925 930
@@ -928,10 +933,8 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
928 return; 933 return;
929 r->last_pulled = now; 934 r->last_pulled = now;
930 } 935 }
931 if (r->pull && 936
932 r->entropy_count < (nbytes << (ENTROPY_SHIFT + 3)) && 937 _xfer_secondary_pool(r, nbytes);
933 r->entropy_count < r->poolinfo->poolfracbits)
934 _xfer_secondary_pool(r, nbytes);
935} 938}
936 939
937static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes) 940static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes)