kernel_samsung_a53x/drivers/media
Hans Verkuil 8d6e1c31a6 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-11-19 12:27:17 +01:00
..
cec media: cec: core: avoid confusing "transmit timed out" message 2024-11-19 12:27:08 +01:00
common media: v4l2-tpg: fix some memleaks in tpg_alloc 2024-11-19 08:44:51 +01:00
dvb-core media: edia: dvbdev: fix a use-after-free 2024-11-19 08:44:52 +01:00
dvb-frontends media: mxl5xx: Move xpt structures off stack 2024-11-19 12:27:17 +01:00
firewire Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i2c media: tc358743: register v4l2 async device only after successful setup 2024-11-19 08:44:51 +01:00
mc media: mc: mark the media devnode as registered from the, start 2024-11-19 12:27:17 +01:00
mmc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci media: ngene: Add dvb_ca_en50221_init return value check 2024-11-19 12:26:58 +01:00
platform media: mediatek: vcodec: avoid -Wcast-function-type-strict warning 2024-11-19 08:44:55 +01:00
radio media: radio-shark2: Avoid led_names truncations 2024-11-19 12:26:58 +01:00
rc media: rc: bpf attach/detach requires write permission 2024-11-18 12:13:31 +01:00
spi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
test-drivers media: vivid: avoid integer overflow 2024-11-18 11:43:15 +01:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-11-19 09:22:15 +01:00
usb media: flexcop-usb: fix sanity check of bNumEndpoints 2024-11-19 12:27:06 +01:00
v4l2-core media: v4l2-core: hold videodev_lock until dev reg, finishes 2024-11-19 12:27:17 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00