From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: imx8mp-hdmi-pvi: Fix next_bridge reference leak
Date: Wed, 16 Sep 2026 10:19:53 +0000 [thread overview]
Message-ID: <20260916101954.3FCF21F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916101146.2015255-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/bridge: imx8mp-hdmi-pvi: double-put of next_bridge on unbind
--
commit 86a7e8c2747f218e207c0b6519ab1f7729f32712
Author: Wentao Liang <vulab@iscas.ac.cn>
drm/bridge: imx8mp-hdmi-pvi: Fix next_bridge reference leak
This commit adds a call to drm_bridge_put() in the driver unbind path to
release the reference to the next bridge in the pipeline.
> diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
> index a31d4fc76f35b..c71319bb68f4b 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
> @@ -179,6 +179,7 @@ static void imx8mp_hdmi_pvi_remove(struct platform_device *pdev)
> struct imx8mp_hdmi_pvi *pvi = platform_get_drvdata(pdev);
>
> drm_bridge_remove(&pvi->bridge);
> + drm_bridge_put(pvi->bridge.next_bridge);
[Severity: High]
Does this introduce a double-put of the next_bridge object?
When the device is unbound, devres triggers the cleanup for pvi->bridge
which was allocated with devm_drm_bridge_alloc(). When its refcount drops
to zero, the DRM core calls __drm_bridge_free(), which automatically
releases next_bridge:
drivers/gpu/drm/drm_bridge.c:__drm_bridge_free() {
...
drm_bridge_put(bridge->next_bridge);
...
}
By adding a manual drm_bridge_put() here without clearing the pointer,
won't __drm_bridge_free() drop the reference a second time and potentially
cause a use-after-free?
>
> pm_runtime_disable(&pdev->dev);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916101146.2015255-1-vulab@iscas.ac.cn?part=1
prev parent reply other threads:[~2026-09-16 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 10:11 [PATCH] drm/bridge: imx8mp-hdmi-pvi: Fix next_bridge reference leak Wentao Liang
2026-09-16 10:19 ` sashiko-bot [this message]
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=20260916101954.3FCF21F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vulab@iscas.ac.cn \
/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