From: neil.armstrong@linaro.org
To: Tuo Li <islituo@gmail.com>,
jesszhan0024@gmail.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/panel: Fix a possible null-pointer dereference in jdi_panel_dsi_remove()
Date: Mon, 5 Jan 2026 16:16:08 +0100 [thread overview]
Message-ID: <b229a86e-3f0b-4059-8a1e-de5be71cf3d8@linaro.org> (raw)
In-Reply-To: <20251218120955.11185-1-islituo@gmail.com>
On 12/18/25 13:09, Tuo Li wrote:
> 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>
> ---
> drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> index 23462065d726..ea975170faff 100644
> --- a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> +++ b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
> @@ -434,8 +434,10 @@ static void jdi_panel_dsi_remove(struct mipi_dsi_device *dsi)
> int err;
>
> /* only detach from host for the DSI-LINK2 interface */
> - if (!jdi)
> + if (!jdi) {
> mipi_dsi_detach(dsi);
> + return;
> + }
>
> err = jdi_panel_disable(&jdi->base);
> if (err < 0)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
next prev parent reply other threads:[~2026-01-05 15:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 12:09 Tuo Li
2026-01-05 15:16 ` neil.armstrong [this message]
2026-01-13 9:06 ` Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b229a86e-3f0b-4059-8a1e-de5be71cf3d8@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=islituo@gmail.com \
--cc=jesszhan0024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®