diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-10-13 07:51:16 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-10-13 07:51:16 -0300 |
commit | ef7138e66f9b6543dc62506c657ed01618ce8237 (patch) | |
tree | 654f63dc87eaf7071b3a4e3d7e556eaed89dbf11 /linux/drivers/media/video/videodev.c | |
parent | 09079a0af5c7ece49f0e3f98910dd06a5f895e76 (diff) | |
download | mediapointer-dvb-s2-ef7138e66f9b6543dc62506c657ed01618ce8237.tar.gz mediapointer-dvb-s2-ef7138e66f9b6543dc62506c657ed01618ce8237.tar.bz2 |
Fix oops in VIDIOC_G_PARM
From: Jonathan Corbet <corbet-v4l@lwn.net>
The call to v4l2_std_construct() in the VIDIOC_G_PARM handler treats
vfd->current_norm as if it were an index - but it's not. The result is
an oops if the driver has no vidioc_g_parm() method defined. Here's the
fix.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/videodev.c')
-rw-r--r-- | linux/drivers/media/video/videodev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index a8705f7d7..bcaee23da 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -1307,6 +1307,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ret=vfd->vidioc_g_parm(file, fh, p); } else { struct v4l2_standard s; + int i; if (!vfd->tvnormsize) { printk (KERN_WARNING "%s: no TV norms defined!\n", @@ -1317,8 +1318,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id, - vfd->tvnorms[vfd->current_norm].name); + for (i = 0; i < vfd->tvnormsize; i++) + if (vfd->tvnorms[i].id == vfd->current_norm) + break; + if (i >= vfd->tvnormsize) + return -EINVAL; + + v4l2_video_std_construct(&s, vfd->current_norm, + vfd->tvnorms[i].name); memset(p,0,sizeof(*p)); |