Skip to content

Commit

Permalink
[media] VIDIOC_ENUM_FREQ_BANDS fix
Browse files Browse the repository at this point in the history
When VIDIOC_ENUM_FREQ_BANDS is called for a driver that doesn't supply an
enum_freq_bands op, then it will fall back to reporting a single freq band
based on information from g_tuner or g_modulator.

Due to a bug this is an infinite list since the index field wasn't tested.

This patch fixes this and returns -EINVAL if index != 0.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Aug 12, 2012
1 parent 00424c7 commit aa4d9b5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/video/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,
.type = type,
};

if (p->index)
return -EINVAL;
err = ops->vidioc_g_tuner(file, fh, &t);
if (err)
return err;
Expand All @@ -1870,6 +1872,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,

if (type != V4L2_TUNER_RADIO)
return -EINVAL;
if (p->index)
return -EINVAL;
err = ops->vidioc_g_modulator(file, fh, &m);
if (err)
return err;
Expand Down

0 comments on commit aa4d9b5

Please sign in to comment.