From nobody Fri Oct 17 13:42:27 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15A7DC433FE for ; Wed, 19 Oct 2022 09:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232852AbiJSJLn (ORCPT ); Wed, 19 Oct 2022 05:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232759AbiJSJJN (ORCPT ); Wed, 19 Oct 2022 05:09:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2184572B79; Wed, 19 Oct 2022 02:00:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DD3B617E3; Wed, 19 Oct 2022 09:00:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50ED5C433C1; Wed, 19 Oct 2022 09:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170019; bh=nmvG3vBy2Gnd/UxyKgj0D3lIpS0zVnyNZ2NZnicV560=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8qWE62uecf1qftk82RnSvxFEoZCG372SzJr+wXKqk9GIqIItlUYgAc1DmonEjJx9 1V7apZf6qCnskF/TAwmXHjwtSXAkbwWE2fBv0PNaSQjNgHLBu+BOeELjJgaOJXTwUe 4UNA/KfQ2nNQGxRH/1m1djNmaahxIIWBeMv9H6E8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 6.0 497/862] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Wed, 19 Oct 2022 10:29:44 +0200 Message-Id: <20221019083311.936438467@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 1c78f19c3a0ea312a8178a6bfd8934eb93e9b10a ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: df3305156f98 ("[media] v4l: xilinx: Add Xilinx Video IP core") Signed-off-by: Miaoqian Lin Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/xilinx/xilinx-vipp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/pl= atform/xilinx/xilinx-vipp.c index f34f8b077e03..0a16c218a50a 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -471,7 +471,7 @@ static int xvip_graph_dma_init(struct xvip_composite_de= vice *xdev) { struct device_node *ports; struct device_node *port; - int ret; + int ret =3D 0; =20 ports =3D of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports =3D=3D NULL) { @@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_= device *xdev) =20 for_each_child_of_node(ports, port) { ret =3D xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } =20 - return 0; + of_node_put(ports); + return ret; } =20 static void xvip_graph_cleanup(struct xvip_composite_device *xdev) --=20 2.35.1