Skip to content

Commit 576fe93

Browse files
javiercarrascocruzgregkh
authored andcommitted
drm/mediatek: Fix child node refcount handling in early exit
commit f708e8b 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@vger.kernel.org Fixes: d761b94 ("drm/mediatek: Add cnt checking for coverity issue") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20241011-mtk_drm_drv_memleak-v1-1-2b40c74c8d75@gmail.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 22fd237 commit 576fe93

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,10 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
405405
if (temp_drm_priv->mtk_drm_bound)
406406
cnt++;
407407

408-
if (cnt == MAX_CRTC)
408+
if (cnt == MAX_CRTC) {
409+
of_node_put(node);
409410
break;
411+
}
410412
}
411413

412414
if (drm_priv->data->mmsys_dev_num == cnt) {

0 commit comments

Comments
 (0)