Commit b9005988 authored by Zhipeng Lu's avatar Zhipeng Lu Committed by Zhang Zekun
Browse files

media: v4l2-tpg: fix some memleaks in tpg_alloc

stable inclusion
from stable-v4.19.311
commit 0de691ff547d86dd54c24b40a81f9c925df8dd77
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9L9JG
CVE: CVE-2024-27078

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0de691ff547d86dd54c24b40a81f9c925df8dd77



--------------------------------

[ Upstream commit 8cf9c5051076e0eb958f4361d50d8b0c3ee6691c ]

In tpg_alloc, resources should be deallocated in each and every
error-handling paths, since they are allocated in for statements.
Otherwise there would be memleaks because tpg_free is called only when
tpg_alloc return 0.

Fixes: 63881df9 ("[media] vivid: add the Test Pattern Generator")
Signed-off-by: default avatarZhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
parent 9ff44822
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment