Date: Mon, 23 Feb 2015 11:45:27 +0100
From: Torsten Duwe <duwe@lst.de>
To: Theodore Ts'o <tytso@mit.edu>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Fix add_timer_randomness throttling
Patch-mainline: Submitted, 2015-02-23 LKML, superseded in v3.13-rc1 by
Git-commit: 95b709b6be49e4ff3933ef6a5b5e623de2713a71
References: bsc#904883,bsc#904901,FATE#317374

It looks to me that commit a283b5c459784f97 has one replacement too much:
in add_timer_randomness, entropy_count is compared to trickle_thresh,
which are _both_ scaled up by ENTROPY_SHIFT. I'd therefore revert that hunk.

Signed-off-by: Torsten Duwe <duwe@suse.de>

diff --git a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -674,7 +697,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 
 	preempt_disable();
 	/* if over the trickle threshold, use only 1 in 4096 samples */
-	if (ENTROPY_BITS(&input_pool) > trickle_thresh &&
+	if (input_pool.entropy_count > trickle_thresh &&
 	    ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff))
 		goto out;
 
