dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 36/37] drm/sti: hdmi: Switch to atomic bridge callbacks
Date: Tue, 07 Jul 2026 16:11:00 +0000	[thread overview]
Message-ID: <20260707161100.C6C651F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260707-drm-all-atomic-bridges-v2-36-21d03cbca446@kernel.org>

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

Pre-existing issues:
- [High] Memory leak and global list corruption (dangling pointer) if component_add() fails in sti_hdmi_probe().
- [High] Resource leak of the audio platform device and potential NULL pointer dereference if sti_hdmi_bind() fails.
--

--- Patch [36]: [PATCH v2 36/37] drm/sti: hdmi: Switch to atomic bridge callbacks ---
commit fe4cd2364e238c4d447b17cda3c258ebb7c65628
Author: Maxime Ripard <mripard@kernel.org>

drm/sti: hdmi: Switch to atomic bridge callbacks

The hdmi bridge uses the legacy non-atomic pre_enable, enable, disable
and post_disable bridge callbacks.

In order to remove the legacy bridge callback support from the DRM
bridge core, switch to their atomic counterparts and add the bridge
atomic state handlers.

> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index f8222e60b1e01..7ba9e0b7ba6c0 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c

[ ... ]

> @@ -964,16 +966,20 @@ static void sti_hdmi_set_mode(struct drm_bridge *bridge,
>  	}
>  }
>  
> -static void sti_hdmi_bridge_nope(struct drm_bridge *bridge)
> +static void sti_hdmi_bridge_nope(struct drm_bridge *bridge,
> +				 struct drm_atomic_commit *commit)
>  {
>  	/* do nothing */
>  }
>  
>  static const struct drm_bridge_funcs sti_hdmi_bridge_funcs = {
> -	.pre_enable = sti_hdmi_pre_enable,
> -	.enable = sti_hdmi_bridge_nope,
> -	.disable = sti_hdmi_disable,
> -	.post_disable = sti_hdmi_bridge_nope,
> +	.atomic_create_state = drm_atomic_helper_bridge_create_state,
> +	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> +	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> +	.atomic_pre_enable = sti_hdmi_pre_enable,
> +	.atomic_enable = sti_hdmi_bridge_nope,
> +	.atomic_disable = sti_hdmi_disable,
> +	.atomic_post_disable = sti_hdmi_bridge_nope,
>  	.mode_set = sti_hdmi_set_mode,
>  };

[Severity: High]
This is a pre-existing issue, but does sti_hdmi_probe() leak memory and
leave a dangling pointer if component_add() fails?

drivers/gpu/drm/sti/sti_hdmi.c:sti_hdmi_probe() {
	...
	drm_bridge_add(&hdmi->bridge);
	return component_add(&pdev->dev, &sti_hdmi_ops);
}

If component_add() fails, the function returns an error without calling
drm_bridge_remove().

Because the bridge is never removed, the reference count does not drop to
zero during devres cleanup. Could another driver try to access the corrupted
bridge in the global bridge_list, leading to a use-after-free panic when it
accesses the freed devres-managed resources?

[Severity: High]
This isn't a bug introduced by this patch, but does the error handling in
sti_hdmi_bind() leave the audio platform device registered while setting the
connector to NULL?

drivers/gpu/drm/sti/sti_hdmi.c:sti_hdmi_bind() {
	...
err_sysfs:
	hdmi->drm_connector = NULL;
	return -EINVAL;
}

If sti_hdmi_register_audio_driver() succeeds but a subsequent initialization
step fails, we jump to the err_sysfs label, which clears hdmi->drm_connector
without unregistering the active audio device.

Since the ALSA framework may still invoke operations on the registered codec,
can this trigger a NULL pointer dereference when hdmi_audio_get_eld() is
called?

drivers/gpu/drm/sti/sti_hdmi.c:hdmi_audio_get_eld() {
	...
	struct drm_connector *connector = hdmi->drm_connector;

	DRM_DEBUG_DRIVER("\n");
	mutex_lock(&connector->eld_mutex);
	...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707-drm-all-atomic-bridges-v2-0-21d03cbca446@kernel.org?part=36

  reply	other threads:[~2026-07-07 16:11 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 15:11 [PATCH v2 00/37] drm/bridge: Convert all bridges to atomic Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 01/37] drm/adp: mipi: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:29   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 02/37] drm/bridge: analogix-anx6345: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:28   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 03/37] drm/bridge: analogix-anx78xx: " Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 04/37] drm/bridge: aux-bridge: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 05/37] drm/bridge: aux-hpd-bridge: " Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 06/37] drm/bridge: chrontel-ch7033: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 07/37] drm/bridge: cros-ec-anx7688: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:29   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 08/37] drm/bridge: lontium-lt8713sx: " Maxime Ripard
2026-07-07 15:27   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 09/37] drm/bridge: lontium-lt8912b: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 10/37] drm/bridge: lontium-lt9611uxc: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 11/37] drm/bridge: lvds-codec: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 12/37] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:35   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 13/37] drm/bridge: microchip-lvds: " Maxime Ripard
2026-07-07 15:38   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 14/37] drm/bridge: nxp-ptn3460: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:41   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 15/37] drm/bridge: of-display-mode-bridge: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 16/37] drm/bridge: parade-ps8622: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:39   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 17/37] drm/bridge: sii9234: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 18/37] drm/bridge: sil-sii8620: " Maxime Ripard
2026-07-07 15:57   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 19/37] drm/bridge: simple-bridge: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 20/37] drm/bridge: tc358764: " Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 21/37] drm/bridge: tda998x: " Maxime Ripard
2026-07-07 15:52   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 22/37] drm/bridge: ti-tfp410: " Maxime Ripard
2026-07-07 15:48   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 23/37] drm/bridge: ti-tpd12s015: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:43   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 24/37] drm/bridge: thc63lvd1024: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 25/37] drm/bridge: waveshare-dsi: " Maxime Ripard
2026-07-07 15:51   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 26/37] drm/exynos: mic: " Maxime Ripard
2026-07-07 16:00   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 27/37] drm/mcde: dsi: Add atomic bridge state handlers Maxime Ripard
2026-07-07 15:53   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 28/37] drm/mediatek: dpi: Switch to atomic bridge callbacks Maxime Ripard
2026-07-07 15:56   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 29/37] drm/msm: dsi: " Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 30/37] drm/omap: dpi: " Maxime Ripard
2026-07-07 16:08   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 31/37] drm/omap: dsi: " Maxime Ripard
2026-07-07 16:04   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 32/37] drm/omap: sdi: " Maxime Ripard
2026-07-07 16:06   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 33/37] drm/omap: venc: " Maxime Ripard
2026-07-07 16:04   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 34/37] drm/sti: dvo: " Maxime Ripard
2026-07-07 16:09   ` sashiko-bot
2026-07-07 15:11 ` [PATCH v2 35/37] drm/sti: hda: " Maxime Ripard
2026-07-07 15:11 ` [PATCH v2 36/37] drm/sti: hdmi: " Maxime Ripard
2026-07-07 16:11   ` sashiko-bot [this message]
2026-07-07 15:11 ` [PATCH v2 37/37] drm/bridge: Remove legacy bridge callback support Maxime Ripard
2026-07-07 16:17   ` sashiko-bot
2026-07-08 17:12 ` [PATCH v2 00/37] drm/bridge: Convert all bridges to atomic Luca Ceresoli
2026-07-15  7:50 ` Maxime Ripard

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=20260707161100.C6C651F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mripard@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox