aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-bit.c
diff options
context:
space:
mode:
authorJiri Kosina <[email protected]>2013-05-24 15:55:33 -0700
committerLinus Torvalds <[email protected]>2013-05-24 16:22:52 -0700
commit10b3a32d292c21ea5b3ad5ca5975e88bb20b8d68 (patch)
tree773d7546880a333ccdabf72a2480a9e9aabe112e /lib/mpi/mpi-bit.c
parent1e7e2e05c179a68aaf8830fe91547a87f4589e53 (diff)
random: fix accounting race condition with lockless irq entropy_count update
Commit 902c098a3663 ("random: use lockless techniques in the interrupt path") turned IRQ path from being spinlock protected into lockless cmpxchg-retry update. That commit removed r->lock serialization between crediting entropy bits from IRQ context and accounting when extracting entropy on userspace read path, but didn't turn the r->entropy_count reads/updates in account() to use cmpxchg as well. It has been observed, that under certain circumstances this leads to read() on /dev/urandom to return 0 (EOF), as r->entropy_count gets corrupted and becomes negative, which in turn results in propagating 0 all the way from account() to the actual read() call. Convert the accounting code to be the proper lockless counterpart of what has been partially done by 902c098a3663. Signed-off-by: Jiri Kosina <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Greg KH <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-bit.c')
0 files changed, 0 insertions, 0 deletions