]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/panel: Fix a possible null-pointer dereference in jdi_panel_dsi_remove()
authorTuo Li <islituo@gmail.com>
Thu, 18 Dec 2025 12:09:55 +0000 (20:09 +0800)
committerNeil Armstrong <neil.armstrong@linaro.org>
Tue, 13 Jan 2026 08:52:44 +0000 (09:52 +0100)
commit95eed73b871111123a8b1d31cb1fce7e902e49ea
treeca8f792b382d70835b38bd57141fdc14e2d47ceb
parented7417e5b889769ef7f66edfd0f836fa812655bc
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
drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c