kernel_samsung_a53x/drivers/media
Hans Verkuil 1ecfd4df9b media: v4l2-core: v4l2-dv-timings: check cvt/gtf result
commit 9f070b1862f3411b8bcdfd51a8eaad25286f9deb upstream.

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: 2576415846bc ("[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/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-17 13:24:20 +01:00
..
cec media: pulse8-cec: fix data timestamp at pulse8_setup() 2024-11-30 02:33:23 +01:00
common media: v4l2-tpg: prevent the risk of a division by zero 2024-11-30 02:33:23 +01:00
dvb-core media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set 2024-12-17 13:20:51 +01:00
dvb-frontends media: ts2020: fix null-ptr-deref in ts2020_probe() 2024-12-17 13:20:50 +01:00
firewire Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i2c media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-17 13:24:20 +01:00
mc media: mc: mark the media devnode as registered from the, start 2024-11-19 12:27:17 +01:00
mmc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci Revert "media: solo6x10: replace max(a, min(b, c)) by clamp(b, a, c)" 2024-11-24 00:23:52 +01:00
platform media: venus: Fix pm_runtime_set_suspended() with runtime pm enabled 2024-12-17 13:20:50 +01:00
radio media: wl128x: Fix atomicity violation in fmc_send_cmd() 2024-12-17 13:24:20 +01:00
rc lirc: rc_dev_get_from_fd(): fix file leak 2024-11-23 23:20:18 +01:00
spi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
test-drivers media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-17 13:24:20 +01:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-11-19 09:22:15 +01:00
usb media: uvcvideo: Stop stream during unregister 2024-12-17 13:20:50 +01:00
v4l2-core media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-17 13:24:20 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00