lkml.org 
[lkml]   [2004]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 8/22] /dev/random: BUG on premature random users
Date

/dev/random BUG on premature random users

Generate a fatal error if we try to use the get_random_bytes before
we're initialized.


tiny-mpm/drivers/char/random.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)

diff -puN drivers/char/random.c~bug-on-grb drivers/char/random.c
--- tiny/drivers/char/random.c~bug-on-grb 2004-03-20 13:38:22.000000000 -0600
+++ tiny-mpm/drivers/char/random.c 2004-03-20 13:38:22.000000000 -0600
@@ -1412,13 +1412,8 @@ static ssize_t extract_entropy(struct en
*/
void get_random_bytes(void *buf, int nbytes)
{
- if (blocking_pool)
- extract_entropy(blocking_pool, buf, nbytes, 0);
- else if (input_pool)
- extract_entropy(input_pool, buf, nbytes, 0);
- else
- printk(KERN_NOTICE "get_random_bytes called before "
- "random driver initialization\n");
+ BUG_ON(!blocking_pool);
+ extract_entropy(blocking_pool, buf, nbytes, 0);
}

EXPORT_SYMBOL(get_random_bytes);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.054 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site