linux-stable/drivers/media
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
..
cec media: cec: cec-api: add locking in cec_release() 2024-06-16 13:28:44 +02:00
common media: v4l2-tpg: fix some memleaks in tpg_alloc 2024-03-26 18:22:19 -04:00
dvb-core media: edia: dvbdev: fix a use-after-free 2024-03-26 18:22:19 -04:00
dvb-frontends media: mxl5xx: Move xpt structures off stack 2024-06-16 13:28:50 +02:00
firewire media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt() 2021-11-06 13:59:45 +01:00
i2c media: tc358743: register v4l2 async device only after successful setup 2024-03-26 18:22:19 -04:00
mc media: mc: mark the media devnode as registered from the, start 2024-06-16 13:28:50 +02:00
mmc
pci media: ngene: Add dvb_ca_en50221_init return value check 2024-06-16 13:28:39 +02:00
platform media: rockchip: rga: fix swizzling for RGB formats 2024-02-23 08:25:00 +01:00
radio media: radio-shark2: Avoid led_names truncations 2024-06-16 13:28:39 +02:00
rc media: sharp: fix sharp encoding 2023-11-28 16:50:21 +00:00
spi media: cxd2880-spi: Fix a null pointer dereference on error handling path 2021-11-17 09:48:35 +01:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-04-13 12:51:22 +02:00
usb media: stk1160: fix bounds checking in stk1160_copy_video() 2024-06-16 13:28:44 +02:00
v4l2-core media: v4l2-core: hold videodev_lock until dev reg, finishes 2024-06-16 13:28:50 +02:00
Kconfig
Makefile