linux-stable/drivers/media/video
Mike Isely 2de26c0a4a V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standard
The bttv driver function which handles switching of the video standard
(set_tvnorm() in bttv-driver.c) includes a check which can optionally
also reset the cropping configuration to a default value.  It is
"optional" based on a comparison of the cropcap parameters of the
previous vs the newly requested video standard.  The comparison is
being done with a memcmp(), a function which only returns a true value
if the comparison actually fails.

This if-statement appears to have been written to assume wrong
memcmp() semantics.  That is, it was re-initializing the cropping
configuration only if the new video standard did NOT have different
cropcap values.  That doesn't make any sense.  One definitely should
reset things if the cropcap parameters are different - if there's any
comparison to made at all.

The effect of this problem was that a transition from, say, PAL to
NTSC would leave in place old cropping setup that made sense for the
PAL geometry but not for NTSC.  If the application doesn't care about
cropping it also won't try to reset the cropping configuration,
resulting in an improperly cropped video frame.  In the case I was
testing this actually caused black video frames to be displayed.

Another interesting effect of this bug is that if one does something
which does NOT change the video standard and this function is run,
then the cropping setup gets reset anyway - again because of the
backwards comparison.  It turns out that just running anything which
merely opens and closes the video device node (e.g. v4l-info) will
cause this to happen.  One can argue that simply opening the device
node and not doing anything to it should not mess with any of its
state - but because of this behavior, any TV app which does such
things (e.g. xawtv) probably therefore doesn't see the problem.

The solution is to fix the sense of the if-statement.  It's easy to
see how this mistake could have been made given how memcmp() works.
The patch is therefore removal of a single "!" character from the
if-statement in set_tvnorm in bttv-driver.c.

Signed-off-by: Mike Isely <isely@pobox.com>
CC: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-11-07 12:55:08 -02:00
..
au0828 V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
bt8xx V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standard 2009-11-07 12:55:08 -02:00
cpia2
cx18 V4L/DVB (12725): v4l: warn when desired devnodenr is in use & add _no_warn function 2009-09-19 00:19:34 -03:00
cx88 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
cx231xx V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
cx23885 V4L/DVB (13014): Add support for Compro VideoMate E800 (DVB-T part only) 2009-09-19 00:53:06 -03:00
cx25840 V4L/DVB (12613): cx25840: fix determining the firmware name 2009-09-12 12:19:52 -03:00
davinci V4L/DVB (12906d): V4L : vpif updates for DM6467 vpif capture driver 2009-09-19 00:19:40 -03:00
em28xx V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
et61x251 const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
gspca V4L/DVB (13122): gscpa - stv06xx + ov518: dont discard every other frame 2009-11-07 12:55:05 -02:00
hdpvr V4L/DVB (12472): hdpvr-control: fix bad whitespaces 2009-09-12 12:19:02 -03:00
ivtv V4L/DVB (12725): v4l: warn when desired devnodenr is in use & add _no_warn function 2009-09-19 00:19:34 -03:00
ovcamchip
pvrusb2 V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
pwc V4L/DVB (12489): pwc - fix few use-after-free and memory leaks 2009-09-12 12:19:13 -03:00
saa7134 V4L/DVB (13011): Change tuner type of BeholdTV cards 2009-09-19 00:52:50 -03:00
saa7164 media: video: Fix build in saa7164 2009-09-22 18:58:17 -03:00
sn9c102 const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
usbvideo headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
usbvision headers: utsname.h redux 2009-09-23 18:13:10 -07:00
uvc const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
zc0301 const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
zoran const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
adv7170.c
adv7175.c
adv7180.c V4L/DVB (13019): video: initial support for ADV7180 2009-09-19 00:53:39 -03:00
adv7343.c V4L/DVB (12201): adv7343: remove unused #include <linux/version.h> 2009-09-19 00:18:07 -03:00
adv7343_regs.h
arv.c
bt819.c
bt856.c
bt866.c
btcx-risc.c
btcx-risc.h
bw-qcam.c V4L/DVB (12438): Read buffer overflow 2009-08-13 20:39:14 -03:00
bw-qcam.h
c-qcam.c
cafe_ccic-regs.h
cafe_ccic.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
cpia.c headers: remove sched.h from poll.h 2009-10-04 15:05:10 -07:00
cpia.h
cpia_pp.c
cpia_usb.c
cs53l32a.c
cs5345.c
cs8420.h
cx2341x.c
dabusb.c Driver-Core: fix devnode callbacks for dabusb and industrialio 2009-09-21 07:36:33 -07:00
dabusb.h
font.h
hexium_gemini.c
hexium_orion.c
ibmmpeg2.h
indycam.c
indycam.h
ir-kbd-i2c.c V4L/DVB (12595): common/ir: use a struct for keycode tables 2009-09-12 12:19:47 -03:00
Kconfig V4L/DVB (13019): video: initial support for ADV7180 2009-09-19 00:53:39 -03:00
ks0127.c
ks0127.h
m52790.c
Makefile V4L/DVB (13019): video: initial support for ADV7180 2009-09-19 00:53:39 -03:00
meye.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
meye.h
msp3400-driver.c
msp3400-driver.h
msp3400-kthreads.c
mt9m001.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
mt9m111.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
mt9t031.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
mt9v011.c V4L/DVB (12401): m9v011: add vflip/hflip controls to control mirror/upside down 2009-08-13 20:39:08 -03:00
mt9v011.h V4L/DVB (12340): mtv9v011: Add a missing chip version to the driver 2009-08-13 20:39:02 -03:00
mt9v022.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
mx1_camera.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
mx3_camera.c V4L/DVB (12534): soc-camera: V4L2 API compliant scaling (S_FMT) and cropping (S_CROP) 2009-09-19 00:19:17 -03:00
mxb.c V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
mxb.h
omap24xxcam-dma.c
omap24xxcam.c
omap24xxcam.h
ov511.c
ov511.h
ov772x.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
ov7670.c
pms.c
pxa_camera.c V4L/DVB (13131): pxa_camera: fix camera pixel format configuration 2009-11-07 12:55:06 -02:00
s2255drv.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
saa711x_regs.h
saa717x.c
saa5246a.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
saa5249.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
saa6588.c V4L/DVB (12215): saa6588: conform to the final RDS spec. 2009-09-12 12:17:31 -03:00
saa7110.c
saa7115.c
saa7121.h
saa7127.c
saa7146.h
saa7146reg.h
saa7185.c
saa7191.c
saa7191.h
se401.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
se401.h
sh_mobile_ceu_camera.c V4L/DVB (13129): sh_mobile_ceu_camera: fix cropping for scaling clients 2009-11-07 12:55:06 -02:00
soc_camera.c V4L/DVB (13132): fix use-after-free Oops, resulting from a driver-core API change 2009-11-07 12:55:07 -02:00
soc_camera_platform.c V4L/DVB (12580): soc-camera: remove now unneeded subdevice group ID assignments 2009-09-19 00:19:22 -03:00
stk-sensor.c
stk-webcam.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
stk-webcam.h
stradis.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
stv680.c V4L/DVB (12369): stv680: kfree called before usb_kill_urb 2009-09-12 12:18:28 -03:00
stv680.h
tcm825x.c
tcm825x.h
tda7432.c
tda9840.c
tda9875.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
ths7303.c
tlv320aic23b.c
tuner-core.c V4L/DVB (12964): tuner-core: add support for NXP TDA18271 without TDA829X demod 2009-09-19 00:16:01 -03:00
tvaudio.c
tveeprom.c V4L/DVB (12478): ARRAY_SIZE changes 2009-09-12 12:19:05 -03:00
tvp514x.c V4L/DVB (12247): tvp514x: formatting comments as per kernel documentation 2009-09-19 00:18:11 -03:00
tvp514x_regs.h V4L/DVB (12246): tvp514x: Migration to sub-device framework 2009-09-19 00:18:09 -03:00
tvp5150.c
tvp5150_reg.h
tw9910.c V4L/DVB (12536): soc-camera: remove .gain and .exposure struct soc_camera_device members 2009-09-19 00:19:20 -03:00
upd64031a.c
upd64083.c
v4l1-compat.c V4L/DVB (12948): v4l1-compat: fix VIDIOC_G_STD handling 2009-09-19 00:15:25 -03:00
v4l2-common.c V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
v4l2-compat-ioctl32.c V4L/DVB (12549): v4l2: video device: Add FM TX controls default configurations 2009-09-12 12:19:19 -03:00
v4l2-dev.c V4L/DVB (12725): v4l: warn when desired devnodenr is in use & add _no_warn function 2009-09-19 00:19:34 -03:00
v4l2-device.c
v4l2-int-device.c
v4l2-ioctl.c V4L/DVB (12543): v4l: introduce string control support. 2009-09-12 12:19:17 -03:00
videobuf-core.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
videobuf-dma-contig.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
videobuf-dma-sg.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
videobuf-dvb.c
videobuf-vmalloc.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
vino.c const: mark struct vm_struct_operations 2009-09-27 11:39:25 -07:00
vino.h
vivi.c V4L/DVB (12134): vivi: bug: don't assume that S_STD will be called before streaming 2009-07-05 10:05:10 -03:00
vp27smpx.c
vpx3220.c
w9966.c
w9968cf.c V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
w9968cf.h
w9968cf_decoder.h
w9968cf_vpp.h
wm8739.c
wm8775.c
zr364xx.c V4L/DVB (12326): zr364xx: error message when buffer is too small and code cleanup 2009-09-12 12:18:07 -03:00