From: sashiko-bot@kernel.org
To: "WenTao Liang" <vulab@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/mediatek: fix of_node leak in mtk_drm_probe loop
Date: Sun, 28 Jun 2026 14:31:27 +0000 [thread overview]
Message-ID: <20260628143128.4907E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260628141751.47090-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Dropping `private->mutex_node` on bind deferral causes Use-After-Free on retry and double-free in remove.
--
commit f75632ba90679309b109146f80c6f864e8f03801
Author: WenTao Liang <vulab@iscas.ac.cn>
drm/mediatek: fix of_node leak in mtk_drm_probe loop
This commit prevents leaking of_node references in the mtk_drm_probe
loop by properly dropping previously stored references before overwriting
them for the same index.
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index c86a3f54f35bc..58860f7071a9e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
[ ... ]
[Severity: High]
This is a pre-existing issue, but while reviewing the lifecycle of
private->mutex_node managed in this patch, I noticed a potential problem in
mtk_drm_bind() in drivers/gpu/drm/mediatek/mtk_drm_drv.c:
pdev = of_find_device_by_node(private->mutex_node);
if (!pdev) {
dev_err(dev, "Waiting for disp-mutex device %pOF\n",
private->mutex_node);
of_node_put(private->mutex_node);
return -EPROBE_DEFER;
}
Since private->mutex_node is a persistent reference acquired in
mtk_drm_probe(), does dropping it on this -EPROBE_DEFER error path lead
to a use-after-free when the component framework retries the bind operation
and accesses it again?
Furthermore, since mtk_drm_remove() unconditionally cleans up this reference,
would this early drop also result in a double-free during teardown?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260628141751.47090-1-vulab@iscas.ac.cn?part=1
prev parent reply other threads:[~2026-06-28 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 14:17 [PATCH v2] drm/mediatek: fix of_node leak in mtk_drm_probe loop WenTao Liang
2026-06-28 14:31 ` 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=20260628143128.4907E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.