* [PATCH] drm/mediatek: mtk_hdmi_v2: NULL check curr_conn in pre_enable
@ 2026-10-27 9:49 Tang Bin
2026-11-11 6:11 ` CK Hu (胡俊光)
0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2026-10-27 9:49 UTC (permalink / raw)
To: chunkuang.hu, p.zabel, airlied, simona, matthias.bgg,
angelogioacchino.delregno
Cc: dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel,
tangbin, stable
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@vger.kernel.org
Signed-off-by: Tang Bin <tangbin@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/mediatek: mtk_hdmi_v2: NULL check curr_conn in pre_enable
2026-10-27 9:49 [PATCH] drm/mediatek: mtk_hdmi_v2: NULL check curr_conn in pre_enable Tang Bin
@ 2026-11-11 6:11 ` CK Hu (胡俊光)
0 siblings, 0 replies; 2+ messages in thread
From: CK Hu (胡俊光) @ 2026-11-11 6:11 UTC (permalink / raw)
To: p.zabel, AngeloGioacchino Del Regno, chunkuang.hu, tangbin,
airlied, matthias.bgg, simona
Cc: dri-devel, linux-mediatek, stable, linux-arm-kernel, linux-kernel
On Tue, 2026-10-27 at 17:49 +0800, Tang Bin wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> 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@vger.kernel.org
> Signed-off-by: Tang Bin <tangbin@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;
In drm_atomic_helper_commit_encoder_bridge_pre_enable(),
it already ensure drm_atomic_get_new_connector_for_encoder() would not return NULL,
so I would like not to check here to prevent numerous checking.
Regards,
CK
>
> conn_state = drm_atomic_get_new_connector_state(state, hdmi->curr_conn);
> if (WARN_ON(!conn_state))
> --
> 2.52.0.windows.1
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-11 6:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 9:49 [PATCH] drm/mediatek: mtk_hdmi_v2: NULL check curr_conn in pre_enable Tang Bin
2026-11-11 6:11 ` CK Hu (胡俊光)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®