linux-stable/drivers/media/v4l2-core
Hans Verkuil bec5fe171f media: v4l2-core: hold videodev_lock until dev reg, finishes
commit 1ed4477f2e upstream.

After the new V4L2 device node was registered, some additional
initialization was done before the device node was marked as
'registered'. During the time between creating the device node
and marking it as 'registered' it was possible to open the
device node, which would return -ENODEV since the 'registered'
flag was not yet set.

Hold the videodev_lock mutex from just before the device node
is registered until the 'registered' flag is set. Since v4l2_open
will take the same lock, it will wait until this registration
process is finished. This resolves this race condition.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org>      # for vi4.18 and up
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-16 13:28:50 +02:00
..
Kconfig
Makefile
tuner-core.c
v4l2-async.c
v4l2-clk.c
v4l2-common.c
v4l2-compat-ioctl32.c
v4l2-ctrls.c
v4l2-dev.c media: v4l2-core: hold videodev_lock until dev reg, finishes 2024-06-16 13:28:50 +02:00
v4l2-device.c
v4l2-dv-timings.c media: v4l2-dv-timings.c: fix too strict blanking sanity checks 2022-12-14 11:30:43 +01:00
v4l2-event.c
v4l2-fh.c
v4l2-flash-led-class.c
v4l2-fwnode.c media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() 2023-09-23 10:59:49 +02:00
v4l2-i2c.c
v4l2-ioctl.c media: rename VFL_TYPE_GRABBER to _VIDEO 2024-03-26 18:22:22 -04:00
v4l2-mc.c
v4l2-mem2mem.c media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity 2024-03-26 18:22:19 -04:00
v4l2-spi.c
v4l2-subdev.c
v4l2-trace.c
videobuf-core.c
videobuf-dma-contig.c media: videobuf-dma-contig: use dma_mmap_coherent 2023-01-18 11:41:04 +01:00
videobuf-dma-sg.c
videobuf-vmalloc.c