* [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse()
@ 2025-10-29 7:23 Miaoqian Lin
2025-10-29 8:14 ` Markus Schneider-Pargmann
2025-11-19 6:02 ` CK Hu (胡俊光)
0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2025-10-29 7:23 UTC (permalink / raw)
To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
Matthias Brugger, AngeloGioacchino Del Regno,
Markus Schneider-Pargmann, CK Hu, Dmitry Osipenko,
Guillaume Ranquet, dri-devel, linux-mediatek, linux-kernel,
linux-arm-kernel
Cc: linmq006, stable
The function mtk_dp_dt_parse() calls of_graph_get_endpoint_by_regs()
to get the endpoint device node, but fails to call of_node_put() to release
the reference when the function returns. This results in a device node
reference leak.
Fix this by adding the missing of_node_put() call before returning from
the function.
Found via static analysis and code review.
Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/gpu/drm/mediatek/mtk_dp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index bef6eeb30d3e..b0b1e158600f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -2087,6 +2087,7 @@ static int mtk_dp_dt_parse(struct mtk_dp *mtk_dp,
endpoint = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 1, -1);
len = of_property_count_elems_of_size(endpoint,
"data-lanes", sizeof(u32));
+ of_node_put(endpoint);
if (len < 0 || len > 4 || len == 3) {
dev_err(dev, "invalid data lane size: %d\n", len);
return -EINVAL;
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse()
2025-10-29 7:23 [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse() Miaoqian Lin
@ 2025-10-29 8:14 ` Markus Schneider-Pargmann
2025-11-19 6:02 ` CK Hu (胡俊光)
1 sibling, 0 replies; 3+ messages in thread
From: Markus Schneider-Pargmann @ 2025-10-29 8:14 UTC (permalink / raw)
To: Miaoqian Lin, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Simona Vetter, Matthias Brugger, AngeloGioacchino Del Regno,
Markus Schneider-Pargmann, CK Hu, Dmitry Osipenko,
Guillaume Ranquet, dri-devel, linux-mediatek, linux-kernel,
linux-arm-kernel
Cc: stable
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
On Wed Oct 29, 2025 at 8:23 AM CET, Miaoqian Lin wrote:
> The function mtk_dp_dt_parse() calls of_graph_get_endpoint_by_regs()
> to get the endpoint device node, but fails to call of_node_put() to release
> the reference when the function returns. This results in a device node
> reference leak.
>
> Fix this by adding the missing of_node_put() call before returning from
> the function.
>
> Found via static analysis and code review.
>
> Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse()
2025-10-29 7:23 [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse() Miaoqian Lin
2025-10-29 8:14 ` Markus Schneider-Pargmann
@ 2025-11-19 6:02 ` CK Hu (胡俊光)
1 sibling, 0 replies; 3+ messages in thread
From: CK Hu (胡俊光) @ 2025-11-19 6:02 UTC (permalink / raw)
To: dmitry.osipenko, linmq006, chunkuang.hu, simona,
AngeloGioacchino Del Regno, dri-devel, airlied, msp,
linux-arm-kernel, p.zabel, matthias.bgg, granquet, linux-kernel,
linux-mediatek
Cc: stable
On Wed, 2025-10-29 at 15:23 +0800, Miaoqian Lin wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> The function mtk_dp_dt_parse() calls of_graph_get_endpoint_by_regs()
> to get the endpoint device node, but fails to call of_node_put() to release
> the reference when the function returns. This results in a device node
> reference leak.
>
> Fix this by adding the missing of_node_put() call before returning from
> the function.
>
> Found via static analysis and code review.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index bef6eeb30d3e..b0b1e158600f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -2087,6 +2087,7 @@ static int mtk_dp_dt_parse(struct mtk_dp *mtk_dp,
> endpoint = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 1, -1);
> len = of_property_count_elems_of_size(endpoint,
> "data-lanes", sizeof(u32));
> + of_node_put(endpoint);
> if (len < 0 || len > 4 || len == 3) {
> dev_err(dev, "invalid data lane size: %d\n", len);
> return -EINVAL;
> --
> 2.39.5 (Apple Git-154)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-19 6:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-29 7:23 [PATCH] drm/mediatek: Fix device node reference leak in mtk_dp_dt_parse() Miaoqian Lin
2025-10-29 8:14 ` Markus Schneider-Pargmann
2025-11-19 6:02 ` CK Hu (胡俊光)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®