Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind()
@ 2026-05-09  9:18 Wentao Liang
  2026-05-12 21:49 ` kernel test robot
  2026-05-13  2:52 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-05-09  9:18 UTC (permalink / raw)
  To: linux, airlied, simona; +Cc: dri-devel, linux-kernel, Wentao Liang, stable

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-13  2:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09  9:18 [PATCH] drm/armada: fix device_node reference leak in armada_lcd_bind() Wentao Liang
2026-05-12 21:49 ` kernel test robot
2026-05-13  2:52 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox