Andrew Morton
8b76f46a2d
drivers/char/random.c: fix a race which can lead to a bogus BUG()
...
Fix a bug reported by and diagnosed by Aaron Straus.
This is a regression intruduced into 2.6.26 by
commit adc782dae6c4c0f6fb679a48a544cfbcd79ae3dc
Author: Matt Mackall <mpm@selenic.com>
Date: Tue Apr 29 01:03:07 2008 -0700
random: simplify and rename credit_entropy_store
credit_entropy_bits() does:
spin_lock_irqsave(&r->lock, flags);
...
if (r->entropy_count > r->poolinfo->POOLBITS)
r->entropy_count = r->poolinfo->POOLBITS;
so there is a time window in which this BUG_ON():
static size_t account(struct entropy_store *r, size_t nbytes, int min,
int reserved)
{
unsigned long flags;
BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
/* Hold lock while accounting */
spin_lock_irqsave(&r->lock, flags);
can trigger.
We could fix this by moving the assertion inside the lock, but it seems
safer and saner to revert to the old behaviour wherein
entropy_store.entropy_count at no time exceeds
entropy_store.poolinfo->POOLBITS.
Reported-by: Aaron Straus <aaron@merfinllc.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: <stable@kernel.org> [2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-09-02 19:21:40 -07:00
..
2008-08-12 10:13:38 +10:00
2008-08-13 22:02:26 +10:00
2008-07-25 10:53:43 -07:00
2008-08-20 15:40:31 -07:00
2008-07-25 10:53:43 -07:00
2008-08-16 17:21:58 -07:00
2008-07-25 10:53:43 -07:00
2008-07-26 12:00:04 -07:00
2008-08-23 12:14:12 -07:00
2006-10-03 17:59:17 +01:00
2008-08-06 13:24:41 -07:00
2008-07-16 23:27:02 +02:00
2008-04-30 08:29:48 -07:00
2005-04-16 15:20:36 -07:00
2008-04-25 08:04:56 +08:00
2008-06-20 14:05:55 -06:00
2008-07-15 12:24:55 +10:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2008-04-30 08:29:52 -07:00
2005-04-16 15:20:36 -07:00
2008-06-20 14:05:53 -06:00
2008-07-22 13:03:28 -07:00
2008-03-03 14:53:16 -08:00
2005-04-16 15:20:36 -07:00
2005-09-07 16:57:20 -07:00
2005-09-07 16:57:20 -07:00
2005-04-16 15:20:36 -07:00
2008-06-20 14:05:56 -06:00
2008-07-25 10:53:43 -07:00
2008-08-07 09:55:48 +01:00
2008-07-26 13:22:56 -07:00
2008-06-20 14:05:53 -06:00
2008-08-04 16:59:56 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:36 -07:00
2005-04-16 15:20:36 -07:00
2008-07-22 13:03:28 -07:00
2008-06-12 18:05:41 -07:00
2008-07-20 17:12:36 -07:00
2008-06-20 14:05:57 -06:00
2008-02-03 17:11:42 +02:00
2008-07-25 10:53:43 -07:00
2008-04-17 07:46:10 +10:00
2008-08-12 17:52:55 +10:00
2008-08-04 12:02:00 +10:00
2008-07-25 12:06:06 +10:00
2008-07-25 12:06:06 +10:00
2008-02-14 22:11:02 +11:00
2008-07-25 12:06:06 +10:00
2008-07-25 12:06:06 +10:00
2008-08-04 12:02:00 +10:00
2008-04-30 08:29:54 -07:00
2008-05-01 08:04:00 -07:00
2008-06-20 14:05:57 -06:00
2008-07-22 13:03:28 -07:00
2008-07-22 13:13:47 -07:00
2008-08-07 18:07:10 -07:00
2008-07-21 00:55:14 -04:00
2008-07-21 21:54:41 -07:00
2008-08-07 18:07:10 -07:00
2008-06-20 14:05:48 -06:00
2008-02-07 08:42:25 -08:00
2008-07-24 10:47:15 -07:00
2008-07-21 21:54:41 -07:00
2008-07-17 11:34:49 -07:00
2008-07-22 13:03:28 -07:00
2008-04-30 08:29:43 -07:00
2008-07-24 10:47:14 -07:00
2008-07-30 09:41:45 -07:00
2008-04-30 08:29:49 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:34 -07:00
2008-07-20 17:12:34 -07:00
2008-04-30 08:29:54 -07:00
2006-12-08 08:28:44 -08:00
2008-07-23 09:36:23 -07:00
2007-02-12 09:48:30 -08:00
2006-10-05 15:10:12 +01:00
2008-07-26 16:29:24 +01:00
2008-06-20 14:05:53 -06:00
2008-07-25 10:53:43 -07:00
2007-07-21 17:49:16 -07:00
2008-07-20 17:12:34 -07:00
2008-09-02 19:21:40 -07:00
2008-07-21 21:54:41 -07:00
2005-04-16 15:20:36 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:38 -07:00
2008-07-20 17:12:38 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:38 -07:00
2008-08-12 16:07:30 -07:00
2006-01-12 09:09:00 -08:00
2008-06-20 14:05:53 -06:00
2008-07-20 17:12:34 -07:00
2008-07-26 20:29:03 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2008-05-05 12:37:02 -07:00
2008-05-16 12:01:45 -07:00
2008-07-21 21:54:41 -07:00
2008-04-18 22:22:54 -04:00
2008-07-02 15:06:25 -06:00
2008-07-20 17:12:38 -07:00
2008-07-22 13:03:28 -07:00
2008-07-24 10:47:30 -07:00
2008-07-25 10:53:43 -07:00
2008-02-07 08:42:33 -08:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2008-08-16 17:21:58 -07:00
2008-08-07 04:05:46 -04:00
2008-08-07 04:05:46 -04:00
2008-06-27 11:52:45 +02:00
2008-06-20 14:05:53 -06:00
2008-06-20 14:05:51 -06:00
2008-04-30 23:15:34 +02:00
2008-05-01 13:08:16 -04:00
2008-08-27 14:37:09 -07:00
2008-08-27 14:37:09 -07:00
2008-08-01 12:50:15 -07:00
2008-07-21 21:54:41 -07:00
2008-07-21 21:54:41 -07:00
2008-07-25 12:06:06 +10:00
2008-07-26 20:29:03 -07:00
2008-06-20 14:05:53 -06:00
2008-08-15 10:34:07 -07:00
2008-08-15 10:34:07 -07:00