From: Ingo Molnar <mingo@elte.hu>

A certain codepath in the random driver relied on vt_ioctl() being under
the BKL and implicitly disabling preemption.  The code wasn't buggy
upstream but it's slighly unrobust so I think we want the fix upstream too,
independently of the remove-bkl patch.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/char/random.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/char/random.c~random-preempt-safety drivers/char/random.c
--- 25/drivers/char/random.c~random-preempt-safety	Thu Sep 30 15:35:18 2004
+++ 25-akpm/drivers/char/random.c	Thu Sep 30 15:35:18 2004
@@ -807,10 +807,11 @@ static void add_timer_randomness(struct 
 	long		delta, delta2, delta3;
 	int		entropy = 0;
 
+	preempt_disable();
 	/* if over the trickle threshold, use only 1 in 4096 samples */
 	if ( random_state->entropy_count > trickle_thresh &&
 	     (__get_cpu_var(trickle_count)++ & 0xfff))
-		return;
+		goto out;
 
 	/*
 	 * Use get_cycles() if implemented, otherwise fall back to
@@ -861,6 +862,8 @@ static void add_timer_randomness(struct 
 		entropy = int_ln_12bits(delta);
 	}
 	batch_entropy_store(num, time, entropy);
+out:
+	preempt_enable();
 }
 
 void add_keyboard_randomness(unsigned char scancode)
_