Skip to content

Commit 95eed73

Browse files
lituo1996superna9999
authored andcommitted
drm/panel: Fix a possible null-pointer dereference in jdi_panel_dsi_remove()
In jdi_panel_dsi_remove(), jdi is explicitly checked, indicating that it may be NULL: if (!jdi) mipi_dsi_detach(dsi); However, when jdi is NULL, the function does not return and continues by calling jdi_panel_disable(): err = jdi_panel_disable(&jdi->base); Inside jdi_panel_disable(), jdi is dereferenced unconditionally, which can lead to a NULL-pointer dereference: struct jdi_panel *jdi = to_panel_jdi(panel); backlight_disable(jdi->backlight); To prevent such a potential NULL-pointer dereference, return early from jdi_panel_dsi_remove() when jdi is NULL. Signed-off-by: Tuo Li <islituo@gmail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20251218120955.11185-1-islituo@gmail.com
1 parent ed7417e commit 95eed73

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ static void jdi_panel_dsi_remove(struct mipi_dsi_device *dsi)
434434
int err;
435435

436436
/* only detach from host for the DSI-LINK2 interface */
437-
if (!jdi)
437+
if (!jdi) {
438438
mipi_dsi_detach(dsi);
439+
return;
440+
}
439441

440442
err = jdi_panel_disable(&jdi->base);
441443
if (err < 0)

0 commit comments

Comments
 (0)