linux/drivers/media/pci/tw68
harperchen 1634b7adcc media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
When the driver calls tw68_risc_buffer() to prepare the buffer, the
function call dma_alloc_coherent may fail, resulting in a empty buffer
buf->cpu. Later when we free the buffer or access the buffer, null ptr
deref is triggered.

This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.

We believe the bug can be also dynamically triggered from user side.
Similarly, we fix this by checking the return value of tw68_risc_buffer()
and the value of buf->cpu before buffer free.

Signed-off-by: harperchen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-03-19 22:56:45 +01:00
..
Kconfig media: Kconfig: cleanup VIDEO_DEV dependencies 2022-03-18 05:58:35 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tw68-core.c media: tw68: switch from 'pci_' to 'dma_' API 2021-04-06 16:07:42 +02:00
tw68-reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
tw68-risc.c media: tw68: switch from 'pci_' to 'dma_' API 2021-04-06 16:07:42 +02:00
tw68-video.c media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish 2023-03-19 22:56:45 +01:00
tw68.h media: media/pci: don't set description for ENUM_FMT 2019-07-22 14:40:32 -04:00