linux/drivers/media
Chen-Yu Tsai 6def3a5ed8 BACKPORT: media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
[ Upstream commit 8310ca9407 ]

DST_QUEUE_OFF_BASE is applied to offset/mem_offset on MMAP capture buffers
only for the VIDIOC_QUERYBUF ioctl, while the userspace fields (including
offset/mem_offset) are filled in for VIDIOC_{QUERY,PREPARE,Q,DQ}BUF
ioctls. This leads to differences in the values presented to userspace.
If userspace attempts to mmap the capture buffer directly using values
from DQBUF, it will fail.

Move the code that applies the magic offset into a helper, and call
that helper from all four ioctl entry points.

[hverkuil: drop unnecessary '= 0' in v4l2_m2m_querybuf() for ret]

Bug: 223375145
Fixes: 7f98639def ("V4L/DVB: add memory-to-memory device helper framework for videobuf")
Fixes: 908a0d7c58 ("[media] v4l: mem2mem: port to videobuf2")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Change-Id: Ifab9933f85f4ba7e0fadddf52debaf837830a06d
2022-04-22 07:38:57 +00:00
..
cec media: cec-pin: fix interrupt en/disable handling 2022-01-27 10:53:43 +01:00
common media: saa7146: hexium_gemini: Fix a NULL pointer dereference in hexium_attach() 2022-01-27 10:54:16 +01:00
dvb-core media: dmxdev: fix UAF when dvb_register_device() fails 2022-01-27 10:53:49 +01:00
dvb-frontends media: dib8000: Fix a memleak in dib8000_init() 2022-01-27 10:53:54 +01:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-11-06 14:10:09 +01:00
i2c This is the 5.10.80 stable release 2021-11-19 11:50:41 +01:00
mc Merge branch 'android12-5.10' into android12-5.10-lts 2021-07-22 13:32:27 +02:00
mmc
pci This is the 5.10.94 stable release 2022-01-27 11:49:22 +01:00
platform This is the 5.10.96 stable release 2022-02-07 11:17:58 +01:00
radio media: si470x-i2c: fix possible memory leak in si470x_i2c_probe() 2022-01-27 10:53:51 +01:00
rc media: igorplugusb: receiver overflow should be reported 2022-01-27 10:54:16 +01:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-11-18 14:04:04 +01:00
test-drivers
tuners media: msi001: fix possible null-ptr-deref in msi001_probe() 2022-01-27 10:53:56 +01:00
usb media: m920x: don't use stack on USB reads 2022-01-27 10:54:14 +01:00
v4l2-core BACKPORT: media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls 2022-04-22 07:38:57 +00:00
Kconfig This is the 5.10.94 stable release 2022-01-27 11:49:22 +01:00
Makefile