mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drm/mediatek: Add missing IS_ERR check for ovl_adaptor platform device
platform_device_register_data() can fail and return an ERR_PTR, but the
return value is used without checking, leading to an invalid pointer
being stored in ddp_comp[].dev and passed to component_match_add() and
mtk_ddp_comp_init(), which could result in a kernel crash.
Add an IS_ERR() check to jump to the error handling path on failure.
Fixes: 0d9eee9118 ("drm/mediatek: Add drm ovl_adaptor sub driver for MT8195")
Cc: stable@vger.kernel.org
Signed-off-by: Haojie Li <lihaojie@kylinos.cn>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20260825100845.438893-1-lihaojie@kylinos.cn/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
This commit is contained in:
parent
cee9395acd
commit
bce7698e2e
|
|
@ -1112,6 +1112,9 @@ static int mtk_drm_probe(struct platform_device *pdev)
|
|||
PLATFORM_DEVID_AUTO,
|
||||
(void *)private->mmsys_dev,
|
||||
sizeof(*private->mmsys_dev));
|
||||
if (IS_ERR(ovl_adaptor))
|
||||
return PTR_ERR(ovl_adaptor);
|
||||
|
||||
private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev = &ovl_adaptor->dev;
|
||||
mtk_ddp_comp_init(dev, NULL, &private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR],
|
||||
DDP_COMPONENT_DRM_OVL_ADAPTOR);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user