Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: linux@armlinux.org.uk, airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
Date: Sat,  9 May 2026 09:18:21 +0000	[thread overview]
Message-ID: <20260509091821.963513-1-vulab@iscas.ac.cn> (raw)

In armada_lcd_bind(), of_get_child_by_name() obtains a reference to
the "port" device_node which is passed to armada_drm_crtc_create().
On success, the reference is transferred to the crtc structure and
released later. However, if armada_drm_crtc_create() fails, the
function returns directly without releasing the port node, causing a
reference leak.

Fix by adding of_node_put(port) in the error path.

Fixes: 9611cb93fa65 ("drm/armada: register crtc with port")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/armada/armada_crtc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 0900e4466ffb..dfca664847b6 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1035,7 +1035,10 @@ armada_lcd_bind(struct device *dev, struct device *master, void *data)
 		}
 	}
 
-	return armada_drm_crtc_create(drm, dev, res, irq, variant, port);
+	ret = armada_drm_crtc_create(drm, dev, res, irq, variant, port);
+	if (ret)
+		of_node_put(port);
+	return ret;
 }
 
 static void
-- 
2.34.1


             reply	other threads:[~2026-05-09  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  9:18 Wentao Liang [this message]
2026-05-12 21:49 ` [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind() kernel test robot

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=20260509091821.963513-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    /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