android_kernel_xiaomi_sm8350/drivers
David Gibson 5826cade43 [PATCH] ibmveth: Fix index increment calculation
On Thu, Oct 12, 2006 at 06:22:14PM +1000, David Gibson wrote:
> Your recent ibmveth commit, 751ae21c6c
> ("fix int rollover panic"), causes a rapid oops on my test machine
> (POWER5 LPAR).
>
> I've bisected it down to that commit, but am still investigating the
> cause of the crash itself.

Found the problem, I believe: an object lesson in the need for great
caution using ++.

[...]
@@ -213,6 +213,7 @@ static void ibmveth_replenish_buffer_poo
 		}

 		free_index = pool->consumer_index++ % pool->size;
+		pool->consumer_index = free_index;
 		index = pool->free_map[free_index];

 		ibmveth_assert(index != IBM_VETH_INVALID_MAP);

Since the ++ is used as post-increment, the increment is not included
in free_index, and so the added line effectively reverts the
increment.  The produced_index side has an analagous bug.

The following change corrects this:

The recent commit 751ae21c6c introduced
a bug in the producer/consumer index calculation in the ibmveth driver
- incautious use of the post-increment ++ operator resulted in an
increment being immediately reverted.  This patch corrects the logic.

Without this patch, the driver oopses almost immediately after
activation on at least some machines.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-21 14:34:21 -04:00
..
acorn IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
acpi [PATCH] acpi memory hotplug: remove strange add_memory fail message 2006-10-20 10:26:38 -07:00
amba
ata Merge branch 'master' into upstream-fixes 2006-10-11 04:59:46 -04:00
atm Various drivers' irq handlers: kill dead code, needless casts 2006-10-06 15:00:58 -04:00
base driver core: kmalloc() failure check in driver_probe_device 2006-10-18 12:49:56 -07:00
block aoe: fix sysfs_create_file warnings 2006-10-18 12:53:51 -07:00
bluetooth [Bluetooth] Add missing entry for Nokia DTL-4 PCMCIA card 2006-10-20 01:15:04 -07:00
cdrom [PATCH] cdrom: add endianness annotations 2006-10-10 16:15:33 -07:00
char [PATCH] ipmi: fix return codes in failure case 2006-10-20 10:26:44 -07:00
clocksource [PATCH] scx200_hrt: fix precedence bug manifesting as 27x clock in 1 MHz mode 2006-10-04 07:55:14 -07:00
connector
cpufreq [PATCH] cpufreq: make the transition_notifier chain use SRCU 2006-10-04 07:55:30 -07:00
crypto
dio
dma [PATCH] drivers/dma trivial annotations 2006-10-10 15:37:21 -07:00
edac
eisa [PATCH] EISA: handle sysfs errors 2006-10-11 11:14:25 -07:00
fc4 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
firmware [PATCH] firmware/dcdbas: add size check in smi_data_write 2006-10-20 10:26:44 -07:00
hwmon hwmon: Fix debug messages in w83781d 2006-10-18 13:03:09 -07:00
i2c hwmon: Let w83781d and lm78 load again 2006-10-18 13:03:09 -07:00
ide [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
ieee1394 Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2006-10-08 12:28:41 -07:00
infiniband IB/mthca: Use mmiowb after doorbell ring 2006-10-16 20:22:35 -07:00
input Merge master.kernel.org:/home/rmk/linux-2.6-arm 2006-10-17 14:46:31 -07:00
isdn [PATCH] drivers/isdn: ioremap balanced with iounmap 2006-10-20 10:26:43 -07:00
leds [PATCH] drivers/led: handle sysfs errors 2006-10-17 08:18:46 -07:00
macintosh [POWERPC] Fix windfarm platform device usage 2006-10-10 13:56:13 +10:00
mca [PATCH] drivers/mca: handle sysfs errors 2006-10-11 11:14:25 -07:00
md [PATCH] separate bdi congestion functions from queue congestion functions 2006-10-20 10:26:35 -07:00
media V4L/DVB (4750): AGC command1/2 is board specific 2006-10-14 00:44:29 -03:00
message [PATCH] I2O: handle a few sysfs errors 2006-10-17 08:18:46 -07:00
mfd IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
misc [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
mmc [PATCH] passing pointer to setup_timer() should be via unsigned long 2006-10-10 15:37:22 -07:00
mtd [PATCH] mtd: remove several bogus casts to void * in iounmap() argument 2006-10-10 15:37:22 -07:00
net [PATCH] ibmveth: Fix index increment calculation 2006-10-21 14:34:21 -04:00
nubus
oprofile
parisc Build fixes for struct pt_regs removal 2006-10-06 20:47:23 -06:00
parport [PATCH] sparc32 pt_regs fixes 2006-10-08 12:32:35 -07:00
pci [PATCH] Fix up rpaphp driver for pci hotplug header move 2006-10-20 17:56:39 -07:00
pcmcia Merge branch 'irqclean-submit1' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6 2006-10-09 14:21:45 -07:00
pnp Fix DMA resource allocation in ACPIPnP 2006-10-18 11:36:11 -07:00
rapidio Fix several typos in drivers/ 2006-10-03 22:31:37 +02:00
rtc [PATCH] rtc: fix printk of 64-bit res on 32-bit platform 2006-10-17 08:18:47 -07:00
s390 [S390] dasd: clean up timer. 2006-10-18 18:30:53 +02:00
sbus [SPARC] {bbc_,}envctrl: Use call_usermodehelper(). 2006-10-17 19:28:52 -07:00
scsi [PATCH] irq updates: make eata_pio compile 2006-10-20 10:26:38 -07:00
serial [PATCH] Kconfig serial typos 2006-10-20 10:26:36 -07:00
sh
sn [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
spi Various drivers' irq handlers: kill dead code, needless casts 2006-10-06 15:00:58 -04:00
tc [MIPS] Fix DECserial build error by IRQ hander change 2006-10-08 02:38:28 +01:00
telephony [ixj] Add pci dev table for module auto loading. 2006-10-18 08:45:30 -04:00
usb [PATCH] fix PXA2xx UDC compilation error 2006-10-20 17:56:39 -07:00
video [valkyriefb] Ifdef for when CONFIG_NVRAM isn't enabled. 2006-10-18 08:53:37 -04:00
w1 [PATCH] w1 kconfig fix 2006-10-17 08:18:44 -07:00
zorro
Kconfig [PATCH] ioc4: Enable build on non-SN2 2006-10-17 08:18:42 -07:00
Makefile