tmp_suning_uos_patched/drivers/char
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 adc782dae6
    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
..
agp agp: fix SIS 5591/5592 wrong PCI id 2008-08-12 10:13:38 +10:00
hw_random crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore() 2008-08-13 22:02:26 +10:00
ip2
ipmi drivers/char/ipmi/ipmi_si_intf.c:default_find_bmc(): fix leak 2008-08-20 15:40:31 -07:00
mwave
pcmcia removed unused #include <version.h> 2008-08-16 17:21:58 -07:00
rio
tpm
xilinx_hwicap removed unused #include <linux/version.h>'s 2008-08-23 12:14:12 -07:00
.gitignore
amiserial.c m68k/amiserial: fix fallout of tty break handling rework 2008-08-06 13:24:41 -07:00
apm-emulation.c
applicom.c
applicom.h
bfin-otp.c
briq_panel.c
bsr.c
cd1865.h
ChangeLog
consolemap.c
cp437.uni
cs5535_gpio.c
cyclades.c
defkeymap.c_shipped
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1286.c
ds1302.c
ds1620.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
dsp56k.c
dtlk.c
efirtc.c drivers/char/efirtc.c: removed duplicated #include 2008-08-04 16:59:56 -07:00
epca.c
epca.h
epcaconfig.h
esp.c
generic_nvram.c
generic_serial.c
genrtc.c
hangcheck-timer.c
hpet.c
hvc_beat.c
hvc_console.c fix spinlock recursion in hvc_console 2008-08-12 17:52:55 +10:00
hvc_console.h powerpc: Move include files to arch/powerpc/include/asm 2008-08-04 12:02:00 +10:00
hvc_irq.c
hvc_iseries.c
hvc_rtas.c
hvc_vio.c
hvc_xen.c
hvcs.c powerpc: Move include files to arch/powerpc/include/asm 2008-08-04 12:02:00 +10:00
hvsi.c
i8k.c
ip27-rtc.c
isicom.c
istallion.c
Kconfig powerpc/iseries: remove the old viocons driver 2008-08-07 18:07:10 -07:00
keyboard.c
lp.c
Makefile powerpc/iseries: remove the old viocons driver 2008-08-07 18:07:10 -07:00
mbcs.c
mbcs.h
mem.c
misc.c
mmtimer.c
moxa.c
moxa.h
mspec.c
mxser.c Char: mxser, ratelimit ioctl warning 2008-07-30 09:41:45 -07:00
mxser.h
n_hdlc.c
n_r3964.c
n_tty.c
nozomi.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
ppdev.c
ps3flash.c
pty.c
random.c drivers/char/random.c: fix a race which can lead to a bogus BUG() 2008-09-02 19:21:40 -07:00
raw.c
riscom8_reg.h
riscom8.c
riscom8.h
rocket_int.h
rocket.c
rocket.h
rtc.c drivers/char/rtc.c: removed duplicated include 2008-08-12 16:07:30 -07:00
scc.h
scx200_gpio.c
selection.c
ser_a2232.c
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c
snsc_event.c
snsc.c
snsc.h
sonypi.c
specialix_io8.h
specialix.c
stallion.c
sx.c
sx.h
sxboards.h
sxwindow.h
synclink_gt.c removed unused #include <version.h> 2008-08-16 17:21:58 -07:00
synclink.c Merge branch 'for-jeff' of git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6 into tmp 2008-08-07 04:05:46 -04:00
synclinkmp.c Merge branch 'for-jeff' of git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6 into tmp 2008-08-07 04:05:46 -04:00
sysrq.c
tb0219.c
tlclk.c
toshiba.c
tty_audit.c
tty_io.c tty: Fix termios tty window resize race with pty/tty pair 2008-08-27 14:37:09 -07:00
tty_ioctl.c tty: TIOCGSOFTCAR/SSOFTCAR on pty is wron 2008-08-27 14:37:09 -07:00
tty_ldisc.c try harder to load tty ldisc driver 2008-08-01 12:50:15 -07:00
vc_screen.c
viotape.c
virtio_console.c
vme_scc.c
vr41xx_giu.c
vt_ioctl.c tty: remove resize window special case 2008-08-15 10:34:07 -07:00
vt.c tty: remove resize window special case 2008-08-15 10:34:07 -07:00