linux-stable/include/media
Hans Verkuil 0595e0d173 media: vb2: add waiting_in_dqbuf flag
commit d65842f712 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-31 06:46:04 -07:00
..
davinci
drv-intf media: include: media: Add Renesas CEU driver interface 2018-02-26 08:59:41 -05:00
i2c media: i2c: lm3560: add support for lm3559 chip 2018-06-28 07:10:01 -04:00
tpg media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
cec-notifier.h media: cec-notifier: Get notifier by device and connector name 2018-07-13 08:44:16 +01:00
cec-pin.h media: cec: add support for 5V signal testing 2018-07-25 07:11:48 -04:00
cec.h media: cec: keep track of outstanding transmits 2019-01-09 17:38:46 +01:00
demux.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dmxdev.h media: dmxdev: Fix the logic that enables DMA mmap support 2018-02-23 05:27:10 -05:00
dvb-usb-ids.h media: dvb: add alternative USB PID for Hauppauge WinTV-soloHD 2018-05-04 14:20:55 -04:00
dvb_ca_en50221.h
dvb_demux.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dvb_frontend.h media: dvb: represent min/max/step/tolerance freqs in Hz 2018-08-02 18:10:48 -04:00
dvb_math.h
dvb_net.h
dvb_ringbuffer.h
dvb_vb2.h media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dvbdev.h media: dvbdev: add a mutex protecting the "mdev" pointer 2018-05-11 12:09:59 -04:00
imx.h
media-device.h
media-devnode.h
media-entity.h media: entity: fix spelling for media_entity_get_fwnode_pad() 2018-05-09 15:49:41 -04:00
rc-core.h media: rc: default to idle on at startup or after reset 2018-05-14 07:14:51 -04:00
rc-map.h media: rc: add new imon protocol decoder and encoder 2018-03-21 11:12:29 -04:00
rcar-fcp.h
soc_camera.h
tuner-types.h
tuner.h
tveeprom.h
v4l2-async.h
v4l2-clk.h
v4l2-common.h media: v4l-common: Make v4l2_find_nearest_size more sparse-friendly 2018-06-28 09:23:56 -04:00
v4l2-ctrls.h media: v4l2-ctrls.h: fix v4l2_ctrl field description typos 2018-07-25 08:36:05 -04:00
v4l2-dev.h media: v4l2-core: push taking ioctl mutex down to ioctl handler 2018-05-28 16:31:44 -04:00
v4l2-device.h media: v4l2-device.h: always expose mdev 2018-05-11 11:26:56 -04:00
v4l2-dv-timings.h media: v4l2-dv-timings: add v4l2_hdmi_colorimetry() 2018-02-22 12:41:09 -05:00
v4l2-event.h
v4l2-fh.h media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-03 06:32:51 -04:00
v4l2-flash-led-class.h
v4l2-fwnode.h media: v4l: fwnode: Fix comment incorrectly mentioning v4l2_fwnode_parse_endpoint 2018-04-23 17:20:07 -04:00
v4l2-image-sizes.h
v4l2-ioctl.h media: v4l2-ioctl: create helper to fill in v4l2_standard for ENUMSTD 2018-06-28 07:29:24 -04:00
v4l2-mc.h
v4l2-mediabus.h media: v4l2-fwnode: parse 'data-enable-active' prop 2018-07-24 14:57:38 -04:00
v4l2-mem2mem.h media: v4l2-mem2mem: add v4l2_m2m_last_buf() 2018-07-25 08:10:31 -04:00
v4l2-rect.h media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
v4l2-subdev.h media: add tuner standby op, use where needed 2018-03-21 12:05:39 -04:00
videobuf-core.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf-dma-contig.h
videobuf-dma-sg.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf-vmalloc.h MAINTAINERS & files: Canonize the e-mails I use at files 2018-05-04 06:21:06 -04:00
videobuf2-core.h media: vb2: add waiting_in_dqbuf flag 2019-05-31 06:46:04 -07:00
videobuf2-dma-contig.h
videobuf2-dma-sg.h
videobuf2-dvb.h
videobuf2-memops.h
videobuf2-v4l2.h
videobuf2-vmalloc.h
vsp1.h media: vsp1: Support Interlaced display pipelines 2018-08-03 16:02:27 -04:00