From: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx> commit f708e8b4cfd16e5c8cd8d7fcfcb2fb2c6ed93af3 upstream. Early exits (goto, break, return) from for_each_child_of_node() required an explicit call to of_node_put(), which was not introduced with the break if cnt == MAX_CRTC. Add the missing of_node_put() before the break. Cc: stable@xxxxxxxxxxxxxxx Fixes: d761b9450e31 ("drm/mediatek: Add cnt checking for coverity issue") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx> Reviewed-by: CK Hu <ck.hu@xxxxxxxxxxxx> Reviewed-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx> Link: https://patchwork.kernel.org/project/dri-devel/patch/20241011-mtk_drm_drv_memleak-v1-1-2b40c74c8d75@xxxxxxxxx/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -405,8 +405,10 @@ static bool mtk_drm_get_all_drm_priv(str if (temp_drm_priv->mtk_drm_bound) cnt++; - if (cnt == MAX_CRTC) + if (cnt == MAX_CRTC) { + of_node_put(node); break; + } } if (drm_priv->data->mmsys_dev_num == cnt) { Patches currently in stable-queue which might be from javier.carrasco.cruz@xxxxxxxxx are queue-6.12/drm-mediatek-fix-child-node-refcount-handling-in-early-exit.patch queue-6.12/leds-flash-mt6360-fix-device_for_each_child_node-refcounting-in-error-paths.patch queue-6.12/spmi-pmic-arb-fix-return-path-in-for_each_available_child_of_node.patch