patches/0001-Disable-PRNG-entropy-accounting.patch
author Florian Westphal <fw@strlen.de>
Thu, 09 Apr 2009 12:07:21 +0200
changeset 2 d1f6d8b6f81c
permissions -rw-r--r--
Linux 2.6.29 for NSC 0.5.0.

From d8f0df50e5449782d2823ea788fa5e8dc48a4473 Mon Sep 17 00:00:00 2001
From: Florian Westphal <fw@strlen.de>
Date: Sun, 22 Mar 2009 15:09:07 +0100
Subject: [PATCH] Disable PRNG entropy accounting.

The real fix is to either completely replace random.c,
providing our own implementation using ns-3 rng infrastructure,
or feed the prng periodically.
---
 drivers/char/random.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7c13581..1efc24e 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -766,7 +766,15 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
 		      int reserved)
 {
 	unsigned long flags;
-
+#ifdef CONFIG_NSC
+	/*
+	 * prevent infinite loop: if a code path calls get_random_bytes
+	 * and we've run out of entropy, this calls wake_up_interruptible(),
+	 * which calls the code path again, which calls get_random_bytes,
+	 * which calls wake_up which...
+	 */
+	return nbytes;
+#endif
 	/* Hold lock while accounting */
 	spin_lock_irqsave(&r->lock, flags);
 
-- 
1.6.0.6