diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2012-08-01 14:52:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-11 22:21:01 -0400 |
commit | aa4d9b53f0d71ff805bbd1e30fcba9d1827a7dd8 (patch) | |
tree | 3c3cc6a610c91020b0b6f708be77552b01101ded /drivers | |
parent | 00424c7ec5d39044df1ce79d48ff3022838aad44 (diff) |
[media] VIDIOC_ENUM_FREQ_BANDS fix
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index c3b7b5f59b32..54f4ac612e8e 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -1853,6 +1853,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops, | |||
1853 | .type = type, | 1853 | .type = type, |
1854 | }; | 1854 | }; |
1855 | 1855 | ||
1856 | if (p->index) | ||
1857 | return -EINVAL; | ||
1856 | err = ops->vidioc_g_tuner(file, fh, &t); | 1858 | err = ops->vidioc_g_tuner(file, fh, &t); |
1857 | if (err) | 1859 | if (err) |
1858 | return err; | 1860 | return err; |
@@ -1870,6 +1872,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops, | |||
1870 | 1872 | ||
1871 | if (type != V4L2_TUNER_RADIO) | 1873 | if (type != V4L2_TUNER_RADIO) |
1872 | return -EINVAL; | 1874 | return -EINVAL; |
1875 | if (p->index) | ||
1876 | return -EINVAL; | ||
1873 | err = ops->vidioc_g_modulator(file, fh, &m); | 1877 | err = ops->vidioc_g_modulator(file, fh, &m); |
1874 | if (err) | 1878 | if (err) |
1875 | return err; | 1879 | return err; |