linux/drivers/staging
Mauro Carvalho Chehab f4b727b3ae V4L/DVB: tm6000: Fix a panic if buffer become NULL
Changing a video standard takes a long time to happen on tm6000, since it
needs to load another firmware, and the i2c implementation on this device
is really slow. When the driver tries to change the video standard, a
kernel panic is produced:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa0c7b48a>] tm6000_irq_callback+0x57f/0xac2 [tm6000]
...
Kernel panic - not syncing: Fatal exception in interrupt

By inspecting it with gdb:

(gdb) list *tm6000_irq_callback+0x57f
0x348a is in tm6000_irq_callback (drivers/staging/tm6000/tm6000-video.c:202).
197             /* FIXME: move to tm6000-isoc */
198             static int last_line = -2, start_line = -2, last_field = -2;
199
200             /* FIXME: this is the hardcoded window size
201              */
202             unsigned int linewidth = (*buf)->vb.width << 1;
203
204             if (!dev->isoc_ctl.cmd) {
205                     c = (header >> 24) & 0xff;
206

Clearly, it was the trial to access *buf, at line 202 that caused the
Panic.

As ioctl is serialized, While S_STD is handled,QBUF/DQBUF won't be called.
So, the driver will run out of the buffers, and *buf will become NULL.

As, on tm6000, the same URB can contain more than one video buffer, it is
likely to hit a condition where no new buffer is available whily copying
the streams. The fix is to leave the URB copy loop, if there's no more buffers
are available.

The same bug could also be produced by an application that is not fast enough
to request new video buffers.

The same bug were reported by Bee Hock Goh <beehock@gmail.com>.

Thanks-to: Bee Hock Goh <beehock@gmail.com> for reporting the bug
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:19 -03:00
..
arlan Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
asus_oled driver core: Convert some drivers to CLASS_ATTR_STRING 2010-03-07 17:04:48 -08:00
batman-adv include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
comedi include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
crystalhd include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
cx25821 V4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacks 2010-05-19 12:57:13 -03:00
dream include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
dt3155 Staging: dt3155: fix 50Hz configuration 2010-04-30 09:30:10 -07:00
echo
et131x include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
frontier staging: make USB device id constant 2010-03-03 16:42:42 -08:00
go7007 include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hv Staging: hv: name network device ethX rather than sethX 2010-04-30 09:30:10 -07:00
iio Staging: iio: fix up the iio_get_new_idr_val comment 2010-04-30 09:30:11 -07:00
line6 include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
netwave include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
octeon STAGING: octeon-ethernet: Use proper phy addresses for Movidis hardware. 2010-04-30 20:52:53 +01:00
otus staging/otus: include slab.h from usbdrv.h 2010-04-05 11:23:16 +09:00
panel Staging: Cleanup useless headers 2010-03-03 16:43:05 -08:00
phison Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
poch include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pohmelfs include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
quatech_usb2 staging: make USB device id constant 2010-03-03 16:42:42 -08:00
ramzswap include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rar_register Staging: rar_register: add suspend and resume functions 2010-03-03 16:42:57 -08:00
rt2860 Staging: rt2860: add Belkin F5D8055 Wireless-N USB Dongle device id 2010-04-30 09:30:11 -07:00
rt2870 Staging: rt{2860,2870}sta: Use request_firmware() to load firmware 2010-03-03 16:42:48 -08:00
rt3070 Staging: rt3070: md4.h: Checkpatch cleanup 2010-03-03 16:43:07 -08:00
rtl8187se include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rtl8192e include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rtl8192su Staging: add Add Sitecom WL-349 to rtl8192su 2010-04-30 09:30:11 -07:00
rtl8192u include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
samsung-laptop backlight: Allow properties to be passed at registration 2010-03-16 19:47:54 +00:00
sep include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
serqt_usb2 Staging: serqt_usb2: Two branches the same in qt_set_termios() 2010-03-03 16:42:48 -08:00
slicoss Staging: merge staging patches into Linus's main branch 2010-03-04 08:39:02 -08:00
sm7xx include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
strip include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tm6000 V4L/DVB: tm6000: Fix a panic if buffer become NULL 2010-05-19 12:58:19 -03:00
udlfb include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
usbip staging: usbip: Fix deadlock 2010-04-30 09:30:10 -07:00
vme Staging: vme: Re-introduce necessary brackets 2010-04-30 09:30:11 -07:00
vt6655 include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
vt6656 staging: convert to use netdev_for_each_mc_addr 2010-02-18 14:47:51 -08:00
wavelan staging: convert to use netdev_for_each_mc_addr 2010-02-18 14:47:51 -08:00
winbond include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
wlags49_h2 include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
wlags49_h25 Staging: wlags49: fix kconfigs dependancy 2009-12-11 12:23:10 -08:00
wlan-ng include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Kconfig V4L/DVB: tm6000: Allow tm6000 driver compilation 2010-05-18 00:43:56 -03:00
Makefile V4L/DVB: tm6000: Allow tm6000 driver compilation 2010-05-18 00:43:56 -03:00
staging.c