All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Osama Abdelkader" <osama.abdelkader@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels
Date: Wed, 12 Aug 2026 13:16:42 +0000	[thread overview]
Message-ID: <20260812131642.D6FC31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812130429.16850-3-osama.abdelkader@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but there is a Use-After-Free in the driver unbind path due to an ignored error return value from devm_mipi_dsi_attach.
--

--- Patch [3]: [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels ---
commit 4038e87306192174f8d35deb13351bd8c956f7e3
Author: Osama Abdelkader <osama.abdelkader@gmail.com>

drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels

Use the managed MIPI DSI attach helper in Novatek and Raydium panel
drivers and drop the corresponding manual detach calls from remove paths.

> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35510.c b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> index 3189d89c7ca00..e75b6ac3df5c3 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt35510.c
> @@ -1175,7 +1175,7 @@ static int nt35510_probe(struct mipi_dsi_device *dsi)
>  
>  	drm_panel_add(&nt->panel);
>  
> -	ret = mipi_dsi_attach(dsi);
> +	ret = devm_mipi_dsi_attach(&dsi->dev, dsi);
>  	if (ret < 0)
>  		drm_panel_remove(&nt->panel);

[Severity: High]
This is a pre-existing issue, but if devm_mipi_dsi_attach() fails here,
drm_panel_remove() is called, but the nt35510_probe() function still
returns 0 (success) immediately after this. Because probe succeeds, devres
cleanup isn't triggered at probe time.

[ ... ]

> @@ -1186,8 +1186,6 @@ static void nt35510_remove(struct mipi_dsi_device *dsi)
>  {
>  	struct nt35510 *nt = mipi_dsi_get_drvdata(dsi);
>  	int ret;
> -
> -	mipi_dsi_detach(dsi);

[Severity: High]
This isn't a bug introduced by this patch, but when the driver is later unbound,
nt35510_remove() calls drm_panel_remove() a second time. This drops the
refcount to 0, freeing the panel memory prematurely. 

After nt35510_remove() completes, the devres cleanup handlers execute,
including drm_panel_put_void(), which will access the already freed panel
memory resulting in a use-after-free.

Should nt35510_probe() return the error code instead of 0 when
devm_mipi_dsi_attach() fails?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812130429.16850-1-osama.abdelkader@gmail.com?part=3

  reply	other threads:[~2026-08-12 13:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 13:04 [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
2026-08-12 13:04 ` [PATCH v3 2/6] drm/panel: Use devm_mipi_dsi_attach in Samsung panels Osama Abdelkader
2026-08-12 13:04 ` [PATCH v3 3/6] drm/panel: Use devm_mipi_dsi_attach in Novatek and Raydium panels Osama Abdelkader
2026-08-12 13:16   ` sashiko-bot [this message]
2026-08-12 13:04 ` [PATCH v3 4/6] drm/panel: Use devm_mipi_dsi_attach in Himax and Ilitek panels Osama Abdelkader
2026-08-12 13:13   ` sashiko-bot
2026-08-12 13:04 ` [PATCH v3 5/6] drm/panel: Use devm_mipi_dsi_attach in display vendor panels Osama Abdelkader
2026-08-12 13:12   ` sashiko-bot
2026-08-12 13:04 ` [PATCH v3 6/6] drm/panel: Use devm_mipi_dsi_attach in assorted panels Osama Abdelkader
2026-08-12 13:18   ` sashiko-bot
2026-08-12 13:13 ` [PATCH v3 1/6] drm/panel: Use devm_mipi_dsi_attach in BOE panels sashiko-bot
2026-08-12 13:26 ` Maxime Ripard
2026-08-12 13:45   ` Luca Ceresoli
2026-08-12 14:23     ` Osama Abdelkader

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=20260812131642.D6FC31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=osama.abdelkader@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.