@@ -2640,6 +2640,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
size_t entropy)
{
struct entropy_store *poolp = &input_pool;
+ struct queued_entropy q = { 0 };
if (unlikely(crng_init == 0)) {
crng_fast_load(buffer, count);
@@ -2652,8 +2653,9 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
*/
wait_event_interruptible(random_write_wait, kthread_should_stop() ||
ENTROPY_BITS(&input_pool) <= random_write_wakeup_bits);
+ queue_entropy(poolp, &q, entropy << ENTROPY_SHIFT);
mix_pool_bytes(poolp, buffer, count);
- credit_entropy_bits(poolp, entropy);
+ dispatch_queued_entropy(poolp, &q);
}
EXPORT_SYMBOL_GPL(add_hwgenerator_randomness);
In an effort to drop credit_entropy_bits() in favor of the new queue_entropy()/dispatch_queued_entropy() API, convert add_hwgenerator_randomness() from the former to the latter. As a side effect, the pool entropy watermark as tracked over the duration of the mix_pool_bytes() operation is now taken correctly taken into account when calulating the amount of new entropy to dispatch to the pool based on the latter's fill level. Signed-off-by: Nicolai Stange <nstange@suse.de> --- drivers/char/random.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)