linux-stable/include/media
Hyunwoo Kim dc04ff778b media: dvb-core: Fix use-after-free due to race at dvb_register_device()
[ Upstream commit 627bb528b0 ]

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>
Stable-dep-of: 8c64f4cdf4 ("media: edia: dvbdev: fix a use-after-free")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:22:38 -04:00
..
davinci media: davinci/vpbe: array underflow in vpbe_enum_outputs() 2020-01-27 14:50:47 +01:00
drv-intf
i2c
tpg
cec-notifier.h
cec-pin.h
cec.h media: cec/v4l2: move V4L2 specific CEC functions to V4L2 2019-09-16 08:21:46 +02:00
demux.h
dmxdev.h
dvb-usb-ids.h
dvb_ca_en50221.h
dvb_demux.h
dvb_frontend.h
dvb_math.h
dvb_net.h media: dvb-core: Fix use-after-free due on race condition at dvb_net 2023-06-09 10:23:59 +02:00
dvb_ringbuffer.h
dvb_vb2.h
dvbdev.h media: dvb-core: Fix use-after-free due to race at dvb_register_device() 2024-03-26 18:22:38 -04:00
imx.h
media-device.h
media-devnode.h
media-entity.h
rc-core.h
rc-map.h
rcar-fcp.h
soc_camera.h
tuner-types.h
tuner.h
tveeprom.h
v4l2-async.h
v4l2-clk.h
v4l2-common.h
v4l2-ctrls.h
v4l2-dev.h
v4l2-device.h media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros 2020-02-24 08:34:41 +01:00
v4l2-dv-timings.h media: cec/v4l2: move V4L2 specific CEC functions to V4L2 2019-09-16 08:21:46 +02:00
v4l2-event.h
v4l2-fh.h
v4l2-flash-led-class.h
v4l2-fwnode.h
v4l2-image-sizes.h
v4l2-ioctl.h
v4l2-mc.h
v4l2-mediabus.h
v4l2-mem2mem.h media: v4l2-mem2mem: add lock to protect parameter num_rdy 2023-08-30 16:31:43 +02:00
v4l2-rect.h media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments 2020-02-11 04:33:57 -08:00
v4l2-subdev.h media: subdev: disallow ioctl for saa6588/davinci 2021-07-20 16:16:05 +02:00
videobuf-core.h
videobuf-dma-contig.h
videobuf-dma-sg.h
videobuf-vmalloc.h
videobuf2-core.h
videobuf2-dma-contig.h
videobuf2-dma-sg.h
videobuf2-dvb.h
videobuf2-memops.h
videobuf2-v4l2.h
videobuf2-vmalloc.h
vsp1.h media: vsp1: Fix YCbCr planar formats pitch calculation 2019-11-20 18:46:52 +01:00