diff mbox series

[v2] media:exynos4-is: Fix a use after free in isp_video_release

Message ID 20210427060255.3318-1-lyl2019@mail.ustc.edu.cn
State Superseded
Headers show
Series [v2] media:exynos4-is: Fix a use after free in isp_video_release | expand

Commit Message

Lv Yunlong April 27, 2021, 6:02 a.m. UTC
In isp_video_release, file->private_data is freed via
_vb2_fop_release()->v4l2_fh_release(). But the freed
file->private_data is still used in v4l2_fh_is_singular_file()
->v4l2_fh_is_singular(file->private_data), which is a use
after free bug.

My patch set file->private_data to NULL after _vb2_fop_release()
to avoid the use after free.

Fixes: 34947b8aebe3f ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
---
 drivers/media/platform/exynos4-is/fimc-isp-video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
index 612b9872afc8..2e04589068b4 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -315,7 +315,8 @@  static int isp_video_release(struct file *file)
 	}
 
 	_vb2_fop_release(file, NULL);
-
+	file->private_data = NULL;
+
 	if (v4l2_fh_is_singular_file(file)) {
 		fimc_pipeline_call(&ivc->ve, close);