Skip to content

Commit aa4d9b5

Browse files
hverkuilMauro Carvalho Chehab
authored andcommitted
[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 <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 00424c7 commit aa4d9b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/media/video/v4l2-ioctl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,8 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,
18531853
.type = type,
18541854
};
18551855

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

18711873
if (type != V4L2_TUNER_RADIO)
18721874
return -EINVAL;
1875+
if (p->index)
1876+
return -EINVAL;
18731877
err = ops->vidioc_g_modulator(file, fh, &m);
18741878
if (err)
18751879
return err;

0 commit comments

Comments
 (0)