linux-stable/include
Hyunwoo Kim 2d1c19597d media: dvb-core: Fix use-after-free due to race at dvb_register_device()
commit 627bb528b0 upstream.

dvb_register_device() dynamically allocates fops with kmemdup()
to set the fops->owner.
And these fops are registered in 'file->f_ops' using replace_fops()
in the dvb_device_open() process, and kfree()d in dvb_free_device().

However, it is not common to use dynamically allocated fops instead
of 'static const' fops as an argument of replace_fops(),
and UAF may occur.
These UAFs can occur on any dvb type using dvb_register_device(),
such as dvb_dvr, dvb_demux, dvb_frontend, dvb_net, etc.

So, instead of kfree() the fops dynamically allocated in
dvb_register_device() in dvb_free_device() called during the
.disconnect() process, kfree() it collectively in exit_dvbdev()
called when the dvbdev.c module is removed.

Link: https://lore.kernel.org/linux-media/20221117045925.14297-4-imv4bel@gmail.com
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-21 15:45:41 +02:00
..
acpi ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() 2022-11-10 18:14:22 +01:00
asm-generic asm-generic/io.h: suppress endianness warnings for readq() and writeq() 2023-05-17 11:47:30 +02:00
clocksource
crypto
drm drm/bridge: Fix returned array size name for atomic_get_input_bus_fmts kdoc 2023-03-22 13:29:58 +01:00
dt-bindings dt-bindings: clocks: imx8mp: Add ID for usb suspend clock 2023-01-18 11:44:56 +01:00
keys
kunit
kvm
linux Remove DECnet support from kernel 2023-06-21 15:45:38 +02:00
math-emu
media media: dvb-core: Fix use-after-free due to race at dvb_register_device() 2023-06-21 15:45:41 +02:00
memory
misc
net neighbour: delete neigh_lookup_nodev as not used 2023-06-21 15:45:40 +02:00
pcmcia
ras
rdma RDMA/cma: Always set static rate to 0 for RoCE 2023-06-21 15:45:39 +02:00
scsi scsi: iscsi: Fix multiple iSCSI session unbind events sent to userspace 2023-02-01 08:23:16 +01:00
soc firmware: raspberrypi: Introduce devm_rpi_firmware_get() 2023-05-17 11:48:02 +02:00
sound ASoC: soc-pcm: test if a BE can be prepared 2023-06-21 15:45:36 +02:00
target scsi: target: Fix multiple LUN_RESET handling 2023-05-17 11:47:48 +02:00
trace net: qrtr: correct types of trace event parameters 2023-05-17 11:47:50 +02:00
uapi Remove DECnet support from kernel 2023-06-21 15:45:38 +02:00
vdso
video video: of_display_timing.h: include errno.h 2022-07-12 16:32:19 +02:00
xen ACPI: processor: Fix evaluating _PDC method when running as Xen dom0 2023-05-17 11:47:42 +02:00