alistair23-linux/drivers/char
Theodore Ts'o e33ba5fa7a random: fix nasty entropy accounting bug
Commit 0fb7a01af5 "random: simplify accounting code", introduced in
v3.15, has a very nasty accounting problem when the entropy pool has
has fewer bytes of entropy than the number of requested reserved
bytes.  In that case, "have_bytes - reserved" goes negative, and since
size_t is unsigned, the expression:

       ibytes = min_t(size_t, ibytes, have_bytes - reserved);

... does not do the right thing.  This is rather bad, because it
defeats the catastrophic reseeding feature in the
xfer_secondary_pool() path.

It also can cause the "BUG: spinlock trylock failure on UP" for some
kernel configurations when prandom_reseed() calls get_random_bytes()
in the early init, since when the entropy count gets corrupted,
credit_entropy_bits() erroneously believes that the nonblocking pool
has been fully initialized (when in fact it is not), and so it calls
prandom_reseed(true) recursively leading to the spinlock BUG.

The logic is *not* the same it was originally, but in the cases where
it matters, the behavior is the same, and the resulting code is
hopefully easier to read and understand.

Fixes: 0fb7a01af5 "random: simplify accounting code"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Greg Price <price@mit.edu>
Cc: stable@vger.kernel.org  #v3.15
2014-06-15 21:04:32 -04:00
..
agp agp: info leak in agpioc_info_wrap() 2014-05-06 13:05:00 -07:00
hw_random Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2014-04-14 16:04:14 -07:00
ipmi ipmi: boolify some things 2014-04-17 12:30:40 -07:00
mwave drivers/char: delete non-required instances of include <linux/init.h> 2014-02-07 15:10:19 -08:00
pcmcia tty: Fix help text of SYNCLINK_CS 2014-04-16 14:31:13 -07:00
tpm ACPI / TPM: Fix resume regression on Chromebooks 2014-05-12 01:13:28 +02:00
xilinx_hwicap
apm-emulation.c apm-emulation: add hibernation APM events to support suspend2disk 2014-01-07 13:50:28 +01:00
applicom.c
applicom.h
bfin-otp.c
bsr.c
ds1302.c
ds1620.c
dsp56k.c
dtlk.c
efirtc.c
generic_nvram.c
genrtc.c
hangcheck-timer.c
hpet.c
i8k.c Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2014-01-29 18:56:27 -08:00
Kconfig ttyprintk: Allow built as a module 2014-04-16 14:21:06 -07:00
lp.c
Makefile Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-01-29 20:49:12 -08:00
mbcs.c
mbcs.h
mem.c /dev/mem: handle out-of-bounds read/write 2014-02-15 11:51:02 -08:00
misc.c
mmtimer.c
msm_smd_pkt.c
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c char: nwbutton: open-code interruptible_sleep_on 2014-01-08 15:29:52 -08:00
nwbutton.h
nwflash.c
pc8736x_gpio.c
ppdev.c
ps3flash.c
random.c random: fix nasty entropy accounting bug 2014-06-15 21:04:32 -04:00
raw.c raw: test against runtime value of max_raw_minors 2014-02-07 08:29:46 -08:00
rtc.c
scx200_gpio.c
snsc.c
snsc.h
snsc_event.c
sonypi.c
tb0219.c
tile-srom.c drivers/char: delete non-required instances of include <linux/init.h> 2014-02-07 15:10:19 -08:00
tlclk.c
toshiba.c
ttyprintk.c ttyprintk: Allow built as a module 2014-04-16 14:21:06 -07:00
uv_mmtimer.c
virtio_console.c pipe: kill ->map() and ->unmap() 2014-04-01 23:19:19 -04:00