From: sashiko-bot@kernel.org
To: "Osama Abdelkader" <osama.abdelkader@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 4/4] drm/panel: simple: Use managed helpers in panel-simple
Date: Tue, 15 Sep 2026 15:08:25 +0000 [thread overview]
Message-ID: <20260915150825.ED2721F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915145935.60397-5-osama.abdelkader@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/panel: UAF/race in panel-simple due to devres teardown inversion
--
commit 16997c0bba9fd7e98551173f3a8332211618f894
Author: Osama Abdelkader <osama.abdelkader@gmail.com>
drm/panel: simple: Use managed helpers in panel-simple
This commit replaces the manual drm_panel_add and drm_panel_remove
calls in panel-simple with devm_drm_panel_add, removing the explicit
drm_panel_remove call from the remove path.
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index c95964ba25a95..02d21dde57663 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -737,7 +737,9 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
> goto disable_pm_runtime;
> }
>
> - drm_panel_add(&panel->base);
> + err = devm_drm_panel_add(dev, &panel->base);
> + if (err)
> + goto disable_pm_runtime;
>
> return panel;
>
[ ... ]
> @@ -785,7 +787,6 @@ static void panel_simple_remove(struct device *dev)
> {
> struct panel_simple *panel = dev_get_drvdata(dev);
>
> - drm_panel_remove(&panel->base);
> panel_simple_shutdown(dev);
>
> pm_runtime_dont_use_autosuspend(dev);
> pm_runtime_disable(dev);
> if (panel->ddc)
> put_device(&panel->ddc->dev);
[Severity: High]
Does this devres conversion introduce a teardown sequence inversion that leads
to a use-after-free window?
By switching to devm_drm_panel_add in panel_simple_probe, the panel's
removal from the global DRM panel list is deferred until after the
panel_simple_remove callback completes and devres cleanup runs.
However, panel_simple_remove manually shuts down the panel, disables
PM runtime, and drops the DDC adapter reference (via put_device) while the
panel is still registered and discoverable.
If a concurrent display driver probes during this window, can it find the
panel via of_drm_find_panel and call drm_panel_get_modes? This would
dereference the already-released panel->ddc adapter and call PM runtime
functions on a disabled device.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915145935.60397-1-osama.abdelkader@gmail.com?part=4
next prev parent reply other threads:[~2026-09-15 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260915145935.60397-1-osama.abdelkader@gmail.com>
2026-09-15 14:59 ` [PATCH v5 1/4] drm/panel: Use devm_mipi_dsi_attach in BOE panels Osama Abdelkader
2026-09-15 14:59 ` [PATCH v5 2/4] drm/panel: Use managed helpers in Novatek and Raydium panels Osama Abdelkader
2026-09-15 14:59 ` [PATCH v5 3/4] drm/panel: Use managed helpers in assorted panels Osama Abdelkader
2026-09-15 15:11 ` sashiko-bot
2026-09-15 14:59 ` [PATCH v5 4/4] drm/panel: simple: Use managed helpers in panel-simple Osama Abdelkader
2026-09-15 15:08 ` sashiko-bot [this message]
2026-09-16 7:50 ` Luca Ceresoli
2026-09-16 17:25 ` 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=20260915150825.ED2721F000FF@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.