diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-21 05:56:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-21 05:56:35 -0400 |
commit | b84293b23efd8c98416624866389854fd5dc0020 (patch) | |
tree | f18d7f6c6f46c09306c88e5ebc7ad2d72c3f4d21 | |
parent | 026d68be45a217f65f1617d08271f6838bfc07d7 (diff) | |
parent | f9c6d4987b23e0a514464bae6771933a48e4cd01 (diff) |
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
Pull /dev/random fix from Ted Ts'o:
"This fixes a BUG_ON-causing regression that was introduced during the
last merge window"
* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
random: fix BUG_ON caused by accounting simplification
-rw-r--r-- | drivers/char/random.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 6b75713d953a..102c50d38902 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -995,8 +995,11 @@ retry: | |||
995 | ibytes = min_t(size_t, ibytes, have_bytes - reserved); | 995 | ibytes = min_t(size_t, ibytes, have_bytes - reserved); |
996 | if (ibytes < min) | 996 | if (ibytes < min) |
997 | ibytes = 0; | 997 | ibytes = 0; |
998 | entropy_count = max_t(int, 0, | 998 | if (have_bytes >= ibytes + reserved) |
999 | entropy_count - (ibytes << (ENTROPY_SHIFT + 3))); | 999 | entropy_count -= ibytes << (ENTROPY_SHIFT + 3); |
1000 | else | ||
1001 | entropy_count = reserved << (ENTROPY_SHIFT + 3); | ||
1002 | |||
1000 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | 1003 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
1001 | goto retry; | 1004 | goto retry; |
1002 | 1005 | ||