linux/drivers/media
Hans Verkuil d65842f712 media: vb2: add waiting_in_dqbuf flag
Calling VIDIOC_DQBUF can release the core serialization lock pointed to
by vb2_queue->lock if it has to wait for a new buffer to arrive.

However, if userspace dup()ped the video device filehandle, then it is
possible to read or call DQBUF from two filehandles at the same time.

It is also possible to call REQBUFS from one filehandle while the other
is waiting for a buffer. This will remove all the buffers and reallocate
new ones. Removing all the buffers isn't the problem here (that's already
handled correctly by DQBUF), but the reallocating part is: DQBUF isn't
aware that the buffers have changed.

This is fixed by setting a flag whenever the lock is released while waiting
for a buffer to arrive. And checking the flag where needed so we can return
-EBUSY.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reported-by: Syzbot <syzbot+4180ff9ca6810b06c1e9@syzkaller.appspotmail.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-04-22 11:50:07 -04:00
..
cec media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
common media: vb2: add waiting_in_dqbuf flag 2019-04-22 11:50:07 -04:00
dvb-core media: dvbdev: remove double-unlock 2019-03-28 14:36:14 -04:00
dvb-frontends media: dvb: clean up redundant break statements 2019-04-22 11:03:26 -04:00
firewire media: firewire: Fix app_info parameter type in avc_ca{,_app}_info 2018-12-05 05:34:33 -05:00
i2c media: st-mipid02: MIPID02 CSI-2 to PARALLEL bridge driver 2019-04-22 11:39:20 -04:00
mmc media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
pci media: bt8xx: avoid a needless u8 to char conversion 2019-03-29 10:29:40 -04:00
platform media: vivid: use vfree() instead of kfree() for dev->bitmap_cap 2019-04-22 11:43:50 -04:00
radio media: replace strncpy() by strscpy() 2019-03-29 10:26:13 -04:00
rc media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
spi media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
tuners media: tuners: fix several typos 2019-03-01 09:40:29 -05:00
usb media: pvrusb2: Prevent a buffer overflow 2019-04-22 11:45:08 -04:00
v4l2-core media: v4l2-common: add bayer formats in v4l2_format_info 2019-04-22 10:33:45 -04:00
Kconfig media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
Makefile media: Media Device Allocator API 2019-04-22 11:18:26 -04:00
media-dev-allocator.c media: Media Device Allocator API 2019-04-22 11:18:26 -04:00
media-device.c media: Add a Kconfig option for the Request API 2018-12-05 13:07:43 -05:00
media-devnode.c media: Clear devnode->media_dev holding media_devnode_lock 2019-04-22 11:24:33 -04:00
media-entity.c media: replace WARN_ON in __media_pipeline_start() 2019-03-19 14:01:08 -04:00
media-request.c media: media requests: return EBADR instead of EACCES 2019-03-25 13:26:10 -04:00