* [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP
@ 2026-08-18 9:28 Andrey Troshin
2026-08-18 9:28 ` [PATCH 5.10 2/2] media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization Andrey Troshin
2026-08-19 3:32 ` [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Troshin @ 2026-08-18 9:28 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Andrey Troshin, Sasha Levin, Tiffany Lin, Andrew-CT Chen,
Mauro Carvalho Chehab, Matthias Brugger, linux-media, lvc-project
From: Fullway Wang <fullwaywang@outlook.com>
[ Upstream commit 53dbe08504442dc7ba4865c09b3bbf5fe849681b ]
The return value of devm_kzalloc() needs to be checked to avoid
NULL pointer deference. This is similar to CVE-2022-3113.
Link: https://lore.kernel.org/linux-media/PH7PR20MB5925094DAE3FD750C7E39E01BF712@PH7PR20MB5925.namprd20.prod.outlook.com
Signed-off-by: Fullway Wang <fullwaywang@outlook.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
[Andrey Troshin: backport fixs from
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c
to drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c]
Signed-off-by: Andrey Troshin <drtrosh@yandex-team.ru>
---
Backport fix for CVE-2024-40973
Link: https://nvd.nist.gov/vuln/detail/CVE-2024-40973
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
index d8e66b645bd8..27f08b1d34d1 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
@@ -65,6 +65,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
}
fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL);
+ if (!fw)
+ return ERR_PTR(-ENOMEM);
fw->type = SCP;
fw->ops = &mtk_vcodec_rproc_msg;
fw->scp = scp;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 5.10 2/2] media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization
2026-08-18 9:28 [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Andrey Troshin
@ 2026-08-18 9:28 ` Andrey Troshin
2026-08-19 3:32 ` [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Troshin @ 2026-08-18 9:28 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Andrey Troshin, Sasha Levin, Tiffany Lin, Andrew-CT Chen,
Mauro Carvalho Chehab, Matthias Brugger, linux-media, lvc-project
From: Jiasheng Jiang <jiashengjiangcool@gmail.com>
[ Upstream commit 4936cd5817af35d23e4d283f48fa59a18ef481e4 ]
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: 53dbe0850444 ("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>
[Andrey Troshin: backport fixs from
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c
to drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c]
Signed-off-by: Andrey Troshin <drtrosh@yandex-team.ru>
---
Backport fix for CVE-2025-23160
Link: https://nvd.nist.gov/vuln/detail/CVE-2025-23160
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
index 27f08b1d34d1..eacea997eae0 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_scp.c
@@ -65,8 +65,11 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(struct mtk_vcodec_dev *dev)
}
fw = devm_kzalloc(&dev->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;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP
2026-08-18 9:28 [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Andrey Troshin
2026-08-18 9:28 ` [PATCH 5.10 2/2] media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization Andrey Troshin
@ 2026-08-19 3:32 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-08-19 3:32 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Sasha Levin, Andrey Troshin, Tiffany Lin, Andrew-CT Chen,
Mauro Carvalho Chehab, Matthias Brugger, linux-media, lvc-project
On Tue, Aug 18, 2026 at 12:28:40PM +0300, Andrey Troshin wrote:
> [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP
Queued the series for 5.10, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-19 3:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 9:28 [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Andrey Troshin
2026-08-18 9:28 ` [PATCH 5.10 2/2] media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization Andrey Troshin
2026-08-19 3:32 ` [PATCH 5.10 1/2] media: mtk-vcodec: potential null pointer deference in SCP Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.