mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Miles Krause" <mileskrause5200@gmail.com>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/meson: fix device_node leak in meson_encoder_dsi_probe()
Date: Sun, 06 Sep 2026 19:55:54 +0000	[thread overview]
Message-ID: <20260906195555.6C6DE1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906-meson-dsi-of-node-leak-v1-1-9d183560279d@gmail.com>

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

Pre-existing issues:
- [High] Missing drm_bridge_remove() on error paths after drm_bridge_add() leaves the bridge permanently leaked and attached to the global bridge_list.
--

commit 314776e79a61e3245fd41353a7a8e22de95afc63
Author: Miles Krause <mileskrause5200@gmail.com>

drm/meson: fix device_node leak in meson_encoder_dsi_probe()

This commit fixes a device_node leak in meson_encoder_dsi_probe() by
dropping the reference to the remote node after acquiring the bridge.

> diff --git a/drivers/gpu/drm/meson/meson_encoder_dsi.c b/drivers/gpu/drm/meson/meson_encoder_dsi.c
> --- a/drivers/gpu/drm/meson/meson_encoder_dsi.c
> +++ b/drivers/gpu/drm/meson/meson_encoder_dsi.c
> @@ -120,6 +120,7 @@ int meson_encoder_dsi_probe(struct meson_drm *priv)
>  	}
>  
>  	meson_encoder_dsi->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
> +	of_node_put(remote);
>  	if (!meson_encoder_dsi->bridge.next_bridge)
>  		return dev_err_probe(priv->dev, -EPROBE_DEFER,
>  				     "Failed to find DSI transceiver bridge\n");

[Severity: High]
This is a pre-existing issue, but since you are fixing leaks in this probe
function, could we also address a bridge leak further down in
meson_encoder_dsi_probe()?

When drm_bridge_add() is called, it adds the bridge to the global bridge_list
and increments its refcount. If a subsequent initialization step fails, such
as drm_simple_encoder_init() returning an error:

    drm_bridge_add(&meson_encoder_dsi->bridge);

    meson_encoder_dsi->priv = priv;

    ret = drm_simple_encoder_init(priv->drm, &meson_encoder_dsi->encoder,
                                  DRM_MODE_ENCODER_DSI);
    if (ret)
        return dev_err_probe(priv->dev, ret,
                             "Failed to init DSI encoder\n");

Does this error path return directly without calling drm_bridge_remove()?

Because the devres cleanup for devm_drm_bridge_alloc only drops the refcount
by 1, the bridge remains attached to the list and memory is never freed. If
the module is unloaded, traversing the list later could oops because the
bridge function pointers will point to freed module text.

This same missing drm_bridge_remove() pattern also exists on the error paths
after drm_bridge_add() in meson_encoder_hdmi_probe() in meson_encoder_hdmi.c
and meson_encoder_cvbs_probe() in meson_encoder_cvbs.c.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260906-meson-dsi-of-node-leak-v1-1-9d183560279d@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-09-06 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 19:43 Miles Krause via B4 Relay
2026-09-06 19:55 ` sashiko-bot [this message]
2026-09-10  7:23 ` Neil Armstrong

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=20260906195555.6C6DE1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=mileskrause5200@gmail.com \
    --cc=neil.armstrong@linaro.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

all inboxes | Powered by JetHome®