media: exynos4-is: Fix a use after free in isp_video_release
authorLv Yunlong <lyl2019@mail.ustc.edu.cn>
Sun, 9 May 2021 08:12:31 +0000 (10:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:05 +0000 (16:56 +0200)
commit31157148a591e6b52ecd0c318ea909b20fc21e4c
tree291172c333b0eda99d4306f3d0b995e4dd53e0d6
parent2a91d7cc425cef1dd43311e092accc34f20661f9
media: exynos4-is: Fix a use after free in isp_video_release

[ Upstream commit 01fe904c9afd26e79c1f73aa0ca2e3d785e5e319 ]

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 uses a variable 'is_singular_file' to avoid the uaf.
v3: https://lore.kernel.org/patchwork/patch/1419058/

Fixes: 34947b8aebe3f ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/exynos4-is/fimc-isp-video.c