mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
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>
This commit is contained in:
parent
85608f8e16
commit
cff850312c
@ -920,6 +920,11 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf,
|
|||||||
static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes);
|
static void _xfer_secondary_pool(struct entropy_store *r, size_t nbytes);
|
||||||
static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
|
static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
|
||||||
{
|
{
|
||||||
|
if (!r->pull ||
|
||||||
|
r->entropy_count >= (nbytes << (ENTROPY_SHIFT + 3)) ||
|
||||||
|
r->entropy_count > r->poolinfo->poolfracbits)
|
||||||
|
return;
|
||||||
|
|
||||||
if (r->limit == 0 && random_min_urandom_seed) {
|
if (r->limit == 0 && random_min_urandom_seed) {
|
||||||
unsigned long now = jiffies;
|
unsigned long now = jiffies;
|
||||||
|
|
||||||
@ -928,9 +933,7 @@ static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
|
|||||||
return;
|
return;
|
||||||
r->last_pulled = now;
|
r->last_pulled = now;
|
||||||
}
|
}
|
||||||
if (r->pull &&
|
|
||||||
r->entropy_count < (nbytes << (ENTROPY_SHIFT + 3)) &&
|
|
||||||
r->entropy_count < r->poolinfo->poolfracbits)
|
|
||||||
_xfer_secondary_pool(r, nbytes);
|
_xfer_secondary_pool(r, nbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user