Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Diogo Silva" <diogompaissilva@gmail.com>
Cc: Frank.Li@kernel.org, neil.armstrong@linaro.org,
	wsa+renesas@sang-engineering.com, imx@lists.linux.dev,
	linux-amlogic@lists.infradead.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 01/15] drm/exynos: remove dependency on DRM simple helpers
Date: Mon, 20 Jul 2026 15:52:39 +0000	[thread overview]
Message-ID: <20260720155239.977A51F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260720-drm_simple_encoder_init-v2-1-5020b630668a@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 the DP AUX channel and resources registered by analogix_dp_bind() are leaked if drm_bridge_connector_init() fails, leading to a Use-After-Free (UAF).
--

--- Patch [1]: [PATCH v2 01/15] drm/exynos: remove dependency on DRM simple helpers ---
commit c403fdd838b4dabbda14312eb449cb97a7566462
Author: Diogo Silva <diogompaissilva@gmail.com>
Subject: drm/exynos: remove dependency on DRM simple helpers

The simple KMS helpers are deprecated because they only add an
intermediate layer between drivers and atomic modesetting. Open-code
drm_simple_encoder_init() by calling drm_encoder_init() directly and
providing driver-local drm_encoder_funcs.

> diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c
> index b805403281504..957382223956a 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp.c

[ ... ]

> @@ -95,7 +99,12 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
>  
>  	dp->drm_dev = drm_dev;
>  
> -	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
> +	ret = drm_encoder_init(drm_dev, encoder, &exynos_dp_encoder_funcs,
> +			       DRM_MODE_ENCODER_TMDS, NULL);
> +	if (ret) {
> +		drm_err(drm_dev, "Failed to initialize encoder\n");
> +		return ret;
> +	}
>  
>  	drm_encoder_helper_add(encoder, &exynos_dp_encoder_helper_funcs);

[Severity: High]
This isn't a bug introduced by this patch, but looking further down in
exynos_dp_bind(), if drm_bridge_connector_init() fails, does this code leak
the DP AUX character device and resources registered by analogix_dp_bind()?

Currently, if the bridge connector init fails:

	connector = drm_bridge_connector_init(dp->drm_dev, dp->plat_data.encoder);
	if (IS_ERR(connector)) {
		ret = PTR_ERR(connector);
		dev_err(dp->dev, "Failed to initialize bridge_connector\n");
		return ret;
	}

The error path returns directly without calling analogix_dp_unbind() to roll
back the earlier success of analogix_dp_bind().

Since the component bind fails, the master DRM bind will also fail, and the
component's unbind hook (exynos_dp_unbind()) is never invoked.

When the devres framework later frees the struct analogix_dp_device, could
the still-registered /dev/drm_dp_auxN character device cause a
Use-After-Free if accessed from userspace?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720-drm_simple_encoder_init-v2-0-5020b630668a@gmail.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-07-20 15:52 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 [this message]
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
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=20260720155239.977A51F00A3A@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