All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yige Jiang" <yigejiang86@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/mediatek: Keep the mutex node reference across deferred binds
Date: Fri, 06 Nov 2026 09:26:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-201105@kernel.org> (raw)
In-Reply-To: <confirmed-20261105-38-2e09963f1b23@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] drm/mediatek: device node reference leak in mtk_drm_probe()
  [1]
--

commit ca36688b98d58f438e7795c4737e318297cc995d
Author: Yige Jiang <yigejiang86@gmail.com>

drm/mediatek: Keep the mutex node reference across deferred binds

This commit removes the of_node_put(private->mutex_node) call from the
-EPROBE_DEFER error path in mtk_drm_bind() so the reference acquired in
mtk_drm_probe() is retained until probe failure or mtk_drm_remove().

> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index dc8e3e917dd77..64c912ba95899 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -630,7 +630,6 @@ static int mtk_drm_bind(struct device *dev)
>  	if (!pdev) {
>  		dev_err(dev, "Waiting for disp-mutex device %pOF\n",
>  			private->mutex_node);
> -		of_node_put(private->mutex_node);
>  		return -EPROBE_DEFER;
>  	}

[Severity: Medium]
This problem wasn't introduced by this patch, but can mtk_drm_probe() leak
a device_node reference in private->mutex_node [1]?

drivers/gpu/drm/mediatek/mtk_drm_drv.c:mtk_drm_probe() {
	...
	for_each_child_of_node(phandle->parent, node) {
		...
		if (comp_type == MTK_DISP_MUTEX) {
			int id;

			id = of_alias_get_id(node, "mutex");
			if (id < 0 || id == private->data->mmsys_id) {
				private->mutex_node = of_node_get(node);
				dev_dbg(dev, "get mutex for mmsys %d", private->data->mmsys_id);
			}
			continue;
		}
	...
}

If the loop matches more than one MTK_DISP_MUTEX child node (for instance,
when multiple mutex nodes have no "mutex" alias), private->mutex_node is
overwritten without calling of_node_put() on the previously acquired node,
leaking its reference.

[1] https://sashiko.dev/#/bug/linux-6030c65d-4659-4fa7-8aa2-9eff923ac68e

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/confirmed-20261105-38-2e09963f1b23@gmail.com?part=1

  reply	other threads:[~2026-11-06  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  9:20 [PATCH] drm/mediatek: Keep the mutex node reference across deferred binds Yige Jiang
2026-11-06  9:26 ` sashiko-bot [this message]
2026-11-12  3:01 ` CK Hu (胡俊光)

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=sashiko-outbox-201105@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yigejiang86@gmail.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 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.