random: fix BUG_ON caused by accounting simplification
Commit
ee1de406ba6eb1 ("random: simplify accounting logic") simplified
things too much, in that it allows the following to trigger an
overflow that results in a BUG_ON crash:
dd if=/dev/urandom of=/dev/zero bs=
67108707 count=1
Thanks to Peter Zihlstra for discovering the crash, and Hannes
Frederic for analyizing the root cause.
Signed-off-by: "Theodore Ts'o" <[email protected]>
Reported-by: Peter Zijlstra <[email protected]>
Reported-by: Hannes Frederic Sowa <[email protected]>
Cc: Greg Price <[email protected]>