[PATCH] drm/mediatek: mtk_hdmi_v2: NULL check curr_conn in pre_enable
Tang Bin
tangbin at cmss.chinamobile.com
Tue Oct 27 02:49:41 PDT 2026
mtk_hdmi_v2_bridge_pre_enable() calls
drm_atomic_get_new_connector_state(state, hdmi->curr_conn) which
dereferences hdmi->curr_conn (via drm_connector_index) before the existing
WARN_ON(!conn_state) check. Add WARN_ON(!hdmi->curr_conn) first.
Fixes: 8d0f79886273 ("drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188")
Cc: stable at vger.kernel.org
Signed-off-by: Tang Bin <tangbin at cmss.chinamobile.com>
---
drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index f0277fcf3..c94d22042 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -1026,6 +1026,8 @@ static void mtk_hdmi_v2_bridge_pre_enable(struct drm_bridge *bridge,
/* Retrieve the connector through the atomic state */
hdmi->curr_conn = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+ if (WARN_ON(!hdmi->curr_conn))
+ return;
conn_state = drm_atomic_get_new_connector_state(state, hdmi->curr_conn);
if (WARN_ON(!conn_state))
--
2.52.0.windows.1
More information about the Linux-mediatek
mailing list