WSL2-Linux-Kernel/drivers/media/v4l2-core
Hans Verkuil 4b2be0d3e3 media: v4l2-core: hold videodev_lock until dev reg, finishes
commit 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 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:39:57 +02:00
..
Kconfig
Makefile
tuner-core.c
v4l2-async.c
v4l2-common.c
v4l2-compat-ioctl32.c media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() 2022-10-05 10:39:40 +02:00
v4l2-ctrls-api.c
v4l2-ctrls-core.c media: v4l2-ctrls: Fix off-by-one error in integer menu control check 2022-12-31 13:14:06 +01:00
v4l2-ctrls-defs.c
v4l2-ctrls-priv.h
v4l2-ctrls-request.c
v4l2-dev.c media: v4l2-core: hold videodev_lock until dev reg, finishes 2024-06-16 13:39:57 +02:00
v4l2-device.c
v4l2-dv-timings.c media: v4l2-dv-timings.c: fix too strict blanking sanity checks 2022-12-14 11:37:19 +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-19 12:22:43 +02:00
v4l2-h264.c
v4l2-i2c.c
v4l2-ioctl.c media: v4l: Avoid unaligned access warnings when printing 4cc modifiers 2022-04-08 14:23:14 +02:00
v4l2-jpeg.c media: v4l2-jpeg: ignore the unknown APP14 marker 2023-03-10 09:39:45 +01:00
v4l2-mc.c
v4l2-mem2mem.c media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity 2024-03-26 18:21:26 -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 2022-12-31 13:14:11 +01:00
videobuf-dma-sg.c
videobuf-vmalloc.c