Commit aa4d9b53 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 00424c7e
...@@ -1853,6 +1853,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops, ...@@ -1853,6 +1853,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,
.type = type, .type = type,
}; };
if (p->index)
return -EINVAL;
err = ops->vidioc_g_tuner(file, fh, &t); err = ops->vidioc_g_tuner(file, fh, &t);
if (err) if (err)
return err; return err;
...@@ -1870,6 +1872,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops, ...@@ -1870,6 +1872,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,
if (type != V4L2_TUNER_RADIO) if (type != V4L2_TUNER_RADIO)
return -EINVAL; return -EINVAL;
if (p->index)
return -EINVAL;
err = ops->vidioc_g_modulator(file, fh, &m); err = ops->vidioc_g_modulator(file, fh, &m);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment