linux-uconsole/drivers
Michael S. Tsirkin d283dafb0d virtio: fix out of range array access
commit 3119815912 upstream.

I have observed the following error on virtio-net module unload:

------------[ cut here ]------------
WARNING: at kernel/irq/manage.c:858 __free_irq+0xa0/0x14c()
Hardware name: Bochs
Trying to free already-free IRQ 0
Modules linked in: virtio_net(-) virtio_blk virtio_pci virtio_ring
virtio af_packet e1000 shpchp aacraid uhci_hcd ohci_hcd ehci_hcd [last
unloaded: scsi_wait_scan]
Pid: 1957, comm: rmmod Not tainted 2.6.33-rc8-vhost #24
Call Trace:
 [<ffffffff8103e195>] warn_slowpath_common+0x7c/0x94
 [<ffffffff8103e204>] warn_slowpath_fmt+0x41/0x43
 [<ffffffff810a7a36>] ? __free_pages+0x5a/0x70
 [<ffffffff8107cc00>] __free_irq+0xa0/0x14c
 [<ffffffff8107cceb>] free_irq+0x3f/0x65
 [<ffffffffa0081424>] vp_del_vqs+0x81/0xb1 [virtio_pci]
 [<ffffffffa0091d29>] virtnet_remove+0xda/0x10b [virtio_net]
 [<ffffffffa0075200>] virtio_dev_remove+0x22/0x4a [virtio]
 [<ffffffff812709ee>] __device_release_driver+0x66/0xac
 [<ffffffff81270ab7>] driver_detach+0x83/0xa9
 [<ffffffff8126fc66>] bus_remove_driver+0x91/0xb4
 [<ffffffff81270fcf>] driver_unregister+0x6c/0x74
 [<ffffffffa0075418>] unregister_virtio_driver+0xe/0x10 [virtio]
 [<ffffffffa0091c4d>] fini+0x15/0x17 [virtio_net]
 [<ffffffff8106997b>] sys_delete_module+0x1c3/0x230
 [<ffffffff81007465>] ? old_ich_force_enable_hpet+0x117/0x164
 [<ffffffff813bb720>] ? do_page_fault+0x29c/0x2cc
 [<ffffffff81028e58>] sysenter_dispatch+0x7/0x27
---[ end trace 15e88e4c576cc62b ]---

The bug is in virtio-pci: we use msix_vector as array index to get irq
entry, but some vqs do not have a dedicated vector so this causes an out
of bounds access.  By chance, we seem to often get 0 value, which
results in this error.

Fix by verifying that vector is legal before using it as index.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Shirley Ma <xma@us.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-04-01 15:58:18 -07:00
..
accessibility
acpi ACPI: Be in TS_POLLING state during mwait based C-state entry 2010-03-15 08:49:36 -07:00
amba
ata pata_hpt3x2n: always stretch UltraDMA timing 2010-03-15 08:49:58 -07:00
atm
auxdisplay
base Driver-Core: devtmpfs - reset inode permissions before unlinking 2010-03-15 08:49:53 -07:00
block cciss: Make cciss_seq_show handle holes in the h->drv[] array 2010-02-23 07:37:49 -08:00
bluetooth Bluetooth: Prevent ill-timed autosuspend in USB driver 2010-01-06 15:03:43 -08:00
cdrom
char tty: Fix the ldisc hangup race 2010-03-15 08:49:54 -07:00
clocksource clocksource: Fix up a registration/IRQ race in the sh drivers. 2010-03-15 08:49:44 -07:00
connector connector: Delete buggy notification code. 2010-02-09 04:50:59 -08:00
cpufreq [CPUFREQ] Fix stale cpufreq_cpu_governor pointer 2009-11-17 23:15:04 -05:00
cpuidle drivers/cpuidle/governors/menu.c: fix undefined reference to `__udivdi3' 2010-01-18 10:19:31 -08:00
crypto crypto: padlock-sha - Add import/export support 2010-02-23 07:37:54 -08:00
dca
dio
dma ioat: fix infinite timeout checking in ioat2_quiesce 2010-02-23 07:37:49 -08:00
edac amd64_edac: Do not falsely trigger kerneloops 2010-02-23 07:37:52 -08:00
eisa
firewire firewire: core: add_descriptor size check 2010-02-09 04:50:52 -08:00
firmware DMI: allow omitting ident strings in DMI tables 2010-01-28 15:01:52 -08:00
gpio gpiolib: Actually set output state in wm831x_gpio_direction_output() 2010-03-15 08:49:57 -07:00
gpu drm/edid: Unify detailed block parsing between base and extension blocks 2010-04-01 15:58:12 -07:00
hid HID: usbhid: introduce timeout for stuck ctrl/out URBs 2010-03-15 08:49:37 -07:00
hwmon hwmon: (tmp421) Restore missing inputs 2010-03-15 08:49:57 -07:00
i2c i2c-i801: Don't use the block buffer for I2C block writes 2010-04-01 15:58:07 -07:00
ide slc90e66: fix UDMA handling 2009-12-18 14:05:04 -08:00
idle
ieee1394 headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
ieee802154 ieee802154: dont leak skbs in ieee802154_fake_xmit() 2009-11-19 13:16:21 -08:00
infiniband Fix failure exit in ipathfs 2010-02-09 04:50:48 -08:00
input Input: wacom - ensure the device is initialized properly upon resume 2010-04-01 15:58:17 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-18 14:54:45 -08:00
leds leds-gpio: fix possible crash on OF device unbinding 2009-11-16 11:50:42 +00:00
lguest lguest: fix bug in setting guest GDT entry 2010-01-06 15:05:19 -08:00
macintosh macintosh/therm_adt746x: Fix sysfs attributes lifetime 2010-03-15 08:49:46 -07:00
mca
md dm: free dm_io before bio_endio not after 2010-03-15 08:50:14 -07:00
media V4L/DVB (13961): em28xx-dvb: fix memleak in dvb_fini() 2010-04-01 15:58:13 -07:00
memstick
message SCSI: mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0. 2010-02-23 07:37:55 -08:00
mfd mfd: WM835x GPIO direction register is not locked 2010-01-22 15:18:18 -08:00
misc SCSI: enclosure: fix oops while iterating enclosure_status array 2010-01-25 10:49:37 -08:00
mmc s3cmci: s3cmci_card_present: Use no_detect to decide whether there is a card detect pin 2010-03-15 08:50:14 -07:00
mtd UBI: fix volume creation input checking 2010-02-09 04:50:45 -08:00
net ath9k: fix lockdep warning when unloading module 2010-04-01 15:58:18 -07:00
nubus
of of: Remove nested function 2009-10-15 09:58:27 -06:00
oprofile
parisc
parport
pci pci: add support for 82576NS serdes to existing SR-IOV quirk 2010-04-01 15:58:15 -07:00
pcmcia PCI/cardbus: Add a fixup hook and fix powerpc 2010-01-22 15:18:26 -08:00
platform thinkpad-acpi: fix bluetooth/wwan resume 2010-03-15 08:50:04 -07:00
pnp
power
pps pps: events reporting fix up 2009-11-12 07:26:01 -08:00
ps3
rapidio
regulator regulator: Fix display of null constraints for regulators 2010-02-23 07:37:49 -08:00
rtc rtc-coh901331: fix braces in resume code 2010-03-15 08:50:14 -07:00
s390 dasd: remove strings from s390dbf 2010-02-23 07:37:54 -08:00
sbus
scsi mvsas: add support for Adaptec ASC-1045/1405 SAS/SATA HBA 2010-04-01 15:58:15 -07:00
serial serial: imx: fix NULL dereference Oops when pdata == NULL 2010-03-15 08:49:54 -07:00
sfi
sh
sn
spi SPI: spi_txx9: Fix bit rate calculation 2009-12-02 23:58:32 +00:00
ssb ssb: Fix range check in sprom write 2009-12-18 14:03:24 -08:00
staging Staging: mimio: remove the mimio driver 2010-03-15 08:49:46 -07:00
tc
telephony
thermal acpi: thermal: Add EOL to the trip_point_N_type strings 2009-11-05 17:33:24 -05:00
uio uio: pm_runtime_disable is needed if failed 2009-11-13 11:36:00 +09:00
usb USB: unusual_devs: Add support for multiple Option 3G sticks 2010-03-15 08:50:12 -07:00
uwb headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
video efifb: fix framebuffer handoff 2010-04-01 15:58:13 -07:00
virtio virtio: fix out of range array access 2010-04-01 15:58:18 -07:00
vlynq
w1
watchdog bfin: fix max timeout calculation 2010-03-15 08:49:32 -07:00
xen xen: fix hang on suspend. 2010-01-18 10:19:44 -08:00
zorro
Kconfig
Makefile