linux/drivers/media
Hans Verkuil 4b2be0d3e3 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>
History 2024-06-16 13:39:57 +02:00
..
cec media: cec: core: add adap_nb_transmit_canceled() callback 2024-06-16 13:39:53 +02:00
common media: v4l2-tpg: fix some memleaks in tpg_alloc 2024-03-26 18:21:26 -04:00
dvb-core media: edia: dvbdev: fix a use-after-free 2024-03-26 18:21:26 -04:00
dvb-frontends media: mxl5xx: Move xpt structures off stack 2024-06-16 13:39:57 +02:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-11-06 14:13:30 +01:00
i2c media: tc358743: register v4l2 async device only after successful setup 2024-03-26 18:21:25 -04:00
mc media: mc: mark the media devnode as registered from the, start 2024-06-16 13:39:56 +02:00
mmc media updates for v5.8-rc1 2020-06-03 20:59:38 -07:00
pci media: ipu3-cio2: Request IRQ earlier 2024-06-16 13:39:29 +02:00
platform media: mediatek: vcodec: avoid -Wcast-function-type-strict warning 2024-03-26 18:21:30 -04:00
radio media: radio-shark2: Avoid led_names truncations 2024-06-16 13:39:28 +02:00
rc media: rc: bpf attach/detach requires write permission 2024-02-23 08:55:07 +01:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-11-18 19:16:27 +01:00
test-drivers media: vivid: avoid integer overflow 2023-11-28 16:56:20 +00:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-04-10 16:18:34 +02:00
usb media: flexcop-usb: fix sanity check of bNumEndpoints 2024-06-16 13:39:44 +02:00
v4l2-core media: v4l2-core: hold videodev_lock until dev reg, finishes 2024-06-16 13:39:57 +02:00
Kconfig media: correct MEDIA_TEST_SUPPORT help text 2022-01-27 11:05:20 +01:00
Makefile media: media/test_drivers: rename to test-drivers 2020-04-16 10:38:31 +02:00