linux/drivers/media/pci
Zheng Wang 20568d06f6 media: bttv: fix use after free error due to btv->timeout timer
[ Upstream commit bd5b50b329 ]

There may be some a race condition between timer function
bttv_irq_timeout and bttv_remove. The timer is setup in
probe and there is no timer_delete operation in remove
function. When it hit kfree btv, the function might still be
invoked, which will cause use after free bug.

This bug is found by static analysis, it may be false positive.

Fix it by adding del_timer_sync invoking to the remove function.

cpu0                cpu1
                  bttv_probe
                    ->timer_setup
                      ->bttv_set_dma
                        ->mod_timer;
bttv_remove
  ->kfree(btv);
                  ->bttv_irq_timeout
                    ->USE btv

Fixes: 162e6376ac ("media: pci: Convert timers to use timer_setup()")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-11-20 11:52:14 +01:00
..
b2c2 media: b2c2: Add missing check in flexcop_pci_isr: 2021-11-19 15:40:09 +00:00
bt8xx media: bttv: fix use after free error due to btv->timeout timer 2023-11-20 11:52:14 +01:00
cobalt media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
cx18 media: pci/cx18: fix repeated words in comments 2022-09-24 08:47:29 +02:00
cx88 media: cx88: add IR remote support for NotOnlyTV LV3H 2022-09-24 11:21:43 +02:00
cx23885 media: pci: cx23885: replace BUG with error return 2023-09-23 11:11:06 +02:00
cx25821 media: cx25821: request_irq -> devm_request_irq 2022-05-13 11:02:22 +02:00
ddbridge media: dvb: symbol fixup for dvb_attach() 2023-09-13 09:43:01 +02:00
dm1105 media: dm1105: Fix use after free bug in dm1105_remove due to race condition 2023-05-11 23:03:15 +09:00
dt3155 media: v4l: ioctl: Set bus_info in v4l_querycap() 2022-04-24 08:07:08 +01:00
intel media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning 2023-09-23 11:11:07 +02:00
ivtv media: ivtv: Fix typo 'the the' in comment 2022-08-29 15:32:14 +02:00
mantis media: mantis: remove orphan mantis_core.c 2021-03-22 17:27:13 +01:00
netup_unidvb media: netup_unidvb: fix irq init by register it at the end of probe 2023-06-09 10:34:12 +02:00
ngene media: media/pci/ngene/ngene.h: remove #ifdef NGENE_V4L 2022-08-29 15:37:30 +02:00
pluto2 media: switch from 'pci_' to 'dma_' API 2021-09-30 10:07:55 +02:00
pt1 media: switch from 'pci_' to 'dma_' API 2021-09-30 10:07:55 +02:00
pt3 freezer,sched: Rewrite core freezer logic 2022-09-07 21:53:50 +02:00
saa7134 media: saa7134: fix use after free bug in saa7134_finidev due to race condition 2023-05-11 23:03:15 +09:00
saa7164 media: saa7164: fix missing pci_disable_device() 2022-12-31 13:32:22 +01:00
smipcie media: smipcie: fix interrupt handling and IR timeout 2021-02-05 23:41:25 +01:00
solo6x10 media: solo6x10: fix possible memory leak in solo_sysfs_init() 2022-12-31 13:32:13 +01:00
sta2x11 media: sta2x11: remove VIRT_TO_BUS dependency 2022-06-27 09:12:14 +01:00
tw68 media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish 2023-05-24 17:32:34 +01:00
tw686x media: tw686x: Fix memory leak in tw686x_video_init 2022-06-27 09:24:45 +01:00
tw5864 media: tw5864: Convert to use managed functions pcim* and devm* 2022-06-20 10:30:34 +01:00
zoran media: zoran: move to mainline 2022-08-29 15:33:45 +02:00
Kconfig media: saa7146: deprecate hexium_gemini/orion, mxb and ttpci 2022-08-29 16:46:38 +02:00
Makefile media: saa7146: deprecate hexium_gemini/orion, mxb and ttpci 2022-08-29 16:46:38 +02:00