mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-08 17:04:09 -05:00
media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization
On Mediatek devices with a system companion processor (SCP) the mtk_scp
structure has to be removed explicitly to avoid a resource leak.
Free the structure in case the allocation of the firmware structure fails
during the firmware initialization.
Fixes: 53dbe08504 ("media: mtk-vcodec: potential null pointer deference in SCP")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
committed by
Hans Verkuil
parent
7b0ee2de7c
commit
4936cd5817
@@ -79,8 +79,11 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use
|
||||
}
|
||||
|
||||
fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL);
|
||||
if (!fw)
|
||||
if (!fw) {
|
||||
scp_put(scp);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
fw->type = SCP;
|
||||
fw->ops = &mtk_vcodec_rproc_msg;
|
||||
fw->scp = scp;
|
||||
|
||||
Reference in New Issue
Block a user