From: sashiko-bot@kernel.org
To: "Diogo Silva" <diogompaissilva@gmail.com>
Cc: Frank.Li@kernel.org, linux-amlogic@lists.infradead.org,
imx@lists.linux.dev, wsa+renesas@sang-engineering.com,
dri-devel@lists.freedesktop.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v2 07/15] drm/tidss: remove dependency on DRM simple helpers
Date: Mon, 20 Jul 2026 16:08:33 +0000 [thread overview]
Message-ID: <20260720160833.BD3311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720-drm_simple_encoder_init-v2-7-5020b630668a@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing drm_encoder_cleanup() on error paths causes an immediate Use-After-Free during probe failure due to devm/drmm lifecycle mismatch.
--
--- Patch [7]: [PATCH v2 07/15] drm/tidss: remove dependency on DRM simple helpers ---
commit e1bc7736cc3d912bd63a6e7abbb830479e2c82e1
Author: Diogo Silva <diogompaissilva@gmail.com>
drm/tidss: remove dependency on DRM simple helpers
The simple KMS helpers are deprecated because they only add an
intermediate layer between drivers and atomic modesetting. This commit
open-codes drm_simple_encoder_init() by calling drm_encoder_init()
directly and providing driver-local drm_encoder_funcs.
> diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c
> index 698f8d964ca00..10dbcc6cdf6a8 100644
> --- a/drivers/gpu/drm/tidss/tidss_encoder.c
> +++ b/drivers/gpu/drm/tidss/tidss_encoder.c
[ ... ]
> @@ -95,8 +99,8 @@ int tidss_encoder_create(struct tidss_device *tidss,
> if (IS_ERR(t_enc))
> return PTR_ERR(t_enc);
>
> - ret = drm_simple_encoder_init(&tidss->ddev, &t_enc->encoder,
> - encoder_type);
> + ret = drm_encoder_init(&tidss->ddev, &t_enc->encoder,
> + &tidss_encoder_funcs, encoder_type, NULL);
> if (ret)
> return ret;
>
[Severity: High]
This isn't a bug introduced by this patch, but does this function leak the
initialized encoder into the global mode_config list on subsequent error
paths?
If drm_bridge_attach() or drm_bridge_connector_init() fails later in this
function, they return an error directly without cleaning up the initialized
DRM encoder:
ret = drm_bridge_attach(enc, &t_enc->bridge, NULL,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret) {
dev_err(tidss->dev, "bridge attach failed: %d\n", ret);
return ret;
}
Because t_enc is allocated via devm_drm_bridge_alloc(), devres frees t_enc
as soon as probe fails. The DRM device itself is also devres-managed, so
its cleanup runs after t_enc is freed.
When drm_mode_config_cleanup() iterates over the encoder_list and calls the
.destroy hook on the now-freed t_enc->encoder, will this trigger a
use-after-free?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720-drm_simple_encoder_init-v2-0-5020b630668a@gmail.com?part=7
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-07-20 16:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 15:40 [PATCH v2 00/15] drm/drm_simple: remove drm_simple_encoder_init Diogo Silva
2026-07-20 15:40 ` [PATCH v2 01/15] drm/exynos: remove dependency on DRM simple helpers Diogo Silva
2026-07-20 15:52 ` sashiko-bot
2026-07-20 15:40 ` [PATCH v2 02/15] drm/xlnx/zynqmp_dpsub: " Diogo Silva
2026-07-20 17:49 ` Pandey, Radhey Shyam
2026-07-20 15:40 ` [PATCH v2 03/15] drm/tegra: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 04/15] drm/fsl-dcu: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 05/15] drm/kmb: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 06/15] drm/virtio: " Diogo Silva
2026-07-20 16:00 ` sashiko-bot
2026-07-20 15:40 ` [PATCH v2 07/15] drm/tidss: " Diogo Silva
2026-07-20 16:08 ` sashiko-bot [this message]
2026-07-20 15:40 ` [PATCH v2 08/15] drm/imx: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 09/15] drm/mediatek: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 10/15] drm/renesas/shmobile: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 11/15] drm/hisilicon/kirin: " Diogo Silva
2026-07-20 15:50 ` sashiko-bot
2026-07-20 15:40 ` [PATCH v2 12/15] drm/arm/komeda: " Diogo Silva
2026-07-20 15:40 ` [PATCH v2 13/15] drm/meson: " Diogo Silva
2026-07-20 15:56 ` sashiko-bot
2026-07-20 15:40 ` [PATCH v2 14/15] drm/drm_simple: remove deprecated drm_simple_encoder_init function Diogo Silva
2026-07-20 15:54 ` sashiko-bot
2026-07-20 15:40 ` [PATCH v2 15/15] Documentation/gpu: remove completed drm_simple_encoder_init() todo Diogo Silva
2026-07-20 16:07 ` sashiko-bot
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=20260720160833.BD3311F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=diogompaissilva@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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