Skip to contentSkip to conversation

media: platform: mtk-mdp3: fix NULL deref on failed SCP lookup

PATCH New Johan Hovold 1 participant 1 message Jul 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: platform: mtk-mdp3: fix NULL deref on failed SCP lookup

Add the missing sanity check after looking up the SCP to avoid dereferencing a NULL-pointer in case its driver has not yet been bound.

Fixes 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Cc Moudy Ho <[email protected]>

---

This one applies on top of Guangshuo's fix:

	https://lore.kernel.org/r/[email protected]

Johan

 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +5 -0
index 121b1006ffdc..f412aadb5996 100644
@@ -296,6 +296,11 @@ static int mdp_probe(struct platform_device *pdev)
 		mdp->scp = platform_get_drvdata(mm_pdev);
 	}
 
+	if (!mdp->scp) {
+		ret = -EPROBE_DEFER;
+		goto err_destroy_clock_wq;
+	}
+
 	mdp->rproc_handle = scp_get_rproc(mdp->scp);
 	dev_dbg(&pdev->dev, "MDP rproc_handle: %p", mdp->rproc_handle);
 
Signature · 1 line
2.54.0