Skip to contentSkip to conversation

drm/exynos: dpi: Fix OF node leak in exynos_dpi_parse_dt()

PATCH In review Wentao Liang 3 participants 3 messages Sep 16 – Nov 9

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 10/20 drm/exynos: dpi: Fix OF node leak in exynos_dpi_parse_dt()

In exynos_dpi_parse_dt(), ctx->panel_node is obtained using of_graph_get_remote_node(). However, when "display-timings" child node is present, the driver uses display timings directly and ignores the panel node without releasing the acquired reference count.

Call of_node_put() on ctx->panel_node and set it to NULL when "display-timings" is present to prevent reference leaks.

Fixes 86418f90a4c1 ("drm: convert drivers to use of_graph_get_remote_node")
---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_dpi.c +2 -0
index 0dc36df6ada3..0b64d1031951 100644
@@ -168,6 +168,8 @@ static int exynos_dpi_parse_dt(struct exynos_dpi *ctx)
 		int ret;
 
 		of_node_put(np);
+		of_node_put(ctx->panel_node);
+		ctx->panel_node = NULL;
 
 		vm = devm_kzalloc(dev, sizeof(*ctx->vm), GFP_KERNEL);
 		if (!vm)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 drm/exynos: dpi: release the node after looking up the panel

exynos_dpi_parse_dt() acquires the remote panel node. The posted display-timings fix releases it on that branch, but the panel lookup path still retains it on success and failure, including deferred probe. of_drm_find_panel() does not consume the node reference.

Put the node immediately after the lookup and clear the unused pointer. This covers both lookup outcomes while leaving the separate panel reference and its existing remove-time put unchanged.

Fixes 14b6873a0198 ("drm/exynos: restore parallel output interface support")

---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y. COMPILE_TEST=y.
Baseline and patched target objects built from this exact base. No full kernel/module-link, hardware or runtime test was performed. AI assistance was used for analysis and patch preparation.

This is an incremental patch based on the following posted fixes:
[PATCH 10/20] drm/exynos: dpi: Fix OF node leak in exynos_dpi_parse_dt() <[email protected]>

 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_dpi.c +2 -0
index 92e8bbe9d35b..e98a9be0a705 100644
@@ -243,6 +243,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
 
 	if (ctx->panel_node) {
 		ctx->panel = of_drm_find_panel(ctx->panel_node);
+		of_node_put(ctx->panel_node);
+		ctx->panel_node = NULL;
 		if (IS_ERR(ctx->panel))
 			return ERR_CAST(ctx->panel);
 	}

base-commit: 2637bdec0535a2044cd830eba9a79363651d9043
prerequisite-patch-id: 8f90819fd9f71f55560dc3af57c5a0bad07bc568

#2 lore raw

Re: [PATCH] drm/exynos: dpi: release the node after looking up the panel

Hi,

2026년 11월 5일 (목) 오후 5:07, Yige Jiang <[email protected]>님이 작성:

Quoted 33 lines

exynos_dpi_parse_dt() acquires the remote panel node. The posted display-timings fix releases it on that branch, but the panel lookup path still retains it on success and failure, including deferred probe. of_drm_find_panel() does not consume the node reference.

Put the node immediately after the lookup and clear the unused pointer. This covers both lookup outcomes while leaving the separate panel reference and its existing remove-time put unchanged.

Fixes 14b6873a0198 ("drm/exynos: restore parallel output interface support")

---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y. COMPILE_TEST=y.
Baseline and patched target objects built from this exact base. No full kernel/module-link, hardware or runtime test was performed. AI assistance was used for analysis and patch preparation.

This is an incremental patch based on the following posted fixes:
[PATCH 10/20] drm/exynos: dpi: Fix OF node leak in exynos_dpi_parse_dt() <[email protected]>

 drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_dpi.c +0 -0
index 92e8bbe9d35b..e98a9be0a705 100644

drivers/gpu/drm/exynos/exynos_drm_dpi.c struct drm_encoder *exynos_dpi_probe(struct device *dev) · line 247

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_dpi.c +2 -0
@@ -243,6 +243,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
 
        if (ctx->panel_node) {
                ctx->panel = of_drm_find_panel(ctx->panel_node);
+               of_node_put(ctx->panel_node);
+               ctx->panel_node = NULL;

A patch covering this same of_node_put() change in exynos_dpi_probe() was posted earlier by Wentao Liang[1].

[1] https://lore-kernel.gnuweeb.org/linux-arm-kernel/[email protected]/T/

Thanks,
Inki Dae

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_dpi.c +0 -0
                if (IS_ERR(ctx->panel))
                        return ERR_CAST(ctx->panel);
        }

base-commit: 2637bdec0535a2044cd830eba9a79363651d9043
prerequisite-patch-id: 8f90819fd9f71f55560dc3af57c5a0bad07bc568