linux/drivers/media/test-drivers
Hans Verkuil 9f070b1862 media: v4l2-core: v4l2-dv-timings: check cvt/gtf result
The v4l2_detect_cvt/gtf functions should check the result against the
timing capabilities: these functions calculate the timings, so if they
are out of bounds, they should be rejected.

To do this, add the struct v4l2_dv_timings_cap as argument to those
functions.

This required updates to the adv7604 and adv7842 drivers since the
prototype of these functions has now changed. The timings struct
that is passed to v4l2_detect_cvt/gtf in those two drivers is filled
with the timings detected by the hardware.

The vivid driver was also updated, but an additional check was added:
the width and height specified by VIDIOC_S_DV_TIMINGS has to match the
calculated result, otherwise something went wrong. Note that vivid
*emulates* hardware, so all the values passed to the v4l2_detect_cvt/gtf
functions came from the timings struct that was filled by userspace
and passed on to the driver via VIDIOC_S_DV_TIMINGS. So these fields
can contain random data. Both the constraints check via
struct v4l2_dv_timings_cap and the additional width/height check
ensure that the resulting timings are sane and not messed up by the
v4l2_detect_cvt/gtf calculations.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Fixes: 2576415846 ("[media] v4l2: move dv-timings related code to v4l2-dv-timings.c")
Cc: stable@vger.kernel.org
Reported-by: syzbot+a828133770f62293563e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-media/000000000000013050062127830a@google.com/
2024-10-28 15:35:56 +01:00
..
vicodec media: test-drivers: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:49 +01:00
vidtv media: Switch back to struct platform_driver::remove() 2024-10-12 16:28:25 +02:00
vimc media: test-drivers: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:49 +01:00
visl media: test-drivers: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:49 +01:00
vivid media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-10-28 15:35:56 +01:00
Kconfig media: drop CONFIG_MEDIA_CONTROLLER_REQUEST_API 2023-11-23 13:03:45 +01:00
Makefile media: visl: add virtual stateless decoder driver 2022-11-25 07:32:16 +00:00
vim2m.c media: test-drivers: drop vb2_ops_wait_prepare/finish 2024-10-28 09:19:49 +01:00