The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] media: platform: mtk-mdp3: fix NULL deref on failed SCP lookup
@ 2026-07-06  6:59 Johan Hovold
  0 siblings, 0 replies; only message in thread
From: Johan Hovold @ 2026-07-06  6:59 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Guangshuo Li,
	linux-media, linux-mediatek, linux-kernel, Johan Hovold, stable,
	Moudy Ho

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: stable@vger.kernel.org	# 6.1
Cc: Moudy Ho <moudy.ho@mediatek.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---

This one applies on top of Guangshuo's fix:

	https://lore.kernel.org/r/20260704173119.254975-1-lgs201920130244@gmail.com

Johan


 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index 121b1006ffdc..f412aadb5996 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -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);
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-06  6:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  6:59 [PATCH] media: platform: mtk-mdp3: fix NULL deref on failed SCP lookup Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox