aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorJonathan Corbet <corbet-v4l@lwn.net>2006-10-13 06:51:16 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-13 23:44:20 -0400
commit83427ac5d643308ccb36e05d525949952bdedc27 (patch)
treece2e0b87884e4ed97bf25ea1a43b1c5ea79daa26 /drivers/media/video
parentc12e3be0860652ed1e15c9442adcba44317211d1 (diff)
V4L/DVB (4743): Fix oops in VIDIOC_G_PARM
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 'drivers/media/video')
-rw-r--r--drivers/media/video/videodev.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 98de872042a8..d424a4129d69 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1288,6 +1288,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1288 ret=vfd->vidioc_g_parm(file, fh, p); 1288 ret=vfd->vidioc_g_parm(file, fh, p);
1289 } else { 1289 } else {
1290 struct v4l2_standard s; 1290 struct v4l2_standard s;
1291 int i;
1291 1292
1292 if (!vfd->tvnormsize) { 1293 if (!vfd->tvnormsize) {
1293 printk (KERN_WARNING "%s: no TV norms defined!\n", 1294 printk (KERN_WARNING "%s: no TV norms defined!\n",
@@ -1298,8 +1299,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1298 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1299 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1299 return -EINVAL; 1300 return -EINVAL;
1300 1301
1301 v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id, 1302 for (i = 0; i < vfd->tvnormsize; i++)
1302 vfd->tvnorms[vfd->current_norm].name); 1303 if (vfd->tvnorms[i].id == vfd->current_norm)
1304 break;
1305 if (i >= vfd->tvnormsize)
1306 return -EINVAL;
1307
1308 v4l2_video_std_construct(&s, vfd->current_norm,
1309 vfd->tvnorms[i].name);
1303 1310
1304 memset(p,0,sizeof(*p)); 1311 memset(p,0,sizeof(*p));
1305 1312