From patchwork Wed Oct 19 08:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214639wrs; Wed, 19 Oct 2022 02:13:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qgtldfC+0Tt0bOC+deNl0NigXFcntzLekw8ff/abZ6Q4lxYYJaY1iXHGnsFYz64cWInDH X-Received: by 2002:a17:907:968b:b0:78d:f5c2:70d8 with SMTP id hd11-20020a170907968b00b0078df5c270d8mr5725153ejc.564.1666170804545; Wed, 19 Oct 2022 02:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170804; cv=none; d=google.com; s=arc-20160816; b=wP6llBZ/YPFlI+u9Q3Er//r/efJ3stIGhHZFjEuF45c/EIHLpWwLv7jQv/YufExUI5 vuTvlcIMl0aFjXipywPNghYqh6IWg5ZgbzS9r9p+VPgtchVSYzVkIIivKh9SDD1TtXnM +npYkVTyUcTcQEKVyCfl8qrA+Kk6dwUjSFg9EjlQtHpkpl7GK4k/wh0aukpUXvbdCoEj 40/9o+fusb5kdkSlkn9KSryoC33aN81yEj8k8thxCXTzeNGsYbVeutJcOQluATNZCJ6H O2k1XWulBuN0YlxUTgrJJHMF+TS6yR+HEzqDjKczrqaEgFzWS1CJ3PrfISaugaxJvogQ muHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HVcroQFYgJ+KygxA544ve0GUT+uG9RQyqVeEvFJfVhE=; b=i4NXHyLGaFpCPN7exxCn7OpAPTRns3OxydQnOAVPhRu4wU0M5f455exToqBGQWmtXu iGWYrf8d4uGOA4p7qeqC6K8z5dz8c1FDTSQl0UvRgVt2X1gh3jNR3D5Xnq5VkAUzQTFR foEHBpFKAY2bBIHChlC0aTfOTylJOuPi4iRcxhkVN0n0s67PEufSNnrdyZ56443BmoNp BsVIlnTXFKTI9ldebqrbv6nh5aiZyUfVShu9bA76xj3zKDyS9bZr5Wjg/JjLculIy0ER EeT7j+uhYNnbwGWHSpj1pNYvJNi7Z1a+jN9JQrMs8ka1U8vq+5JW8YJOeEE+Vm0ebB22 vYXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q8qWE62u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck12-20020a0564021c0c00b0045ca1ce94b2si11748979edb.523.2022.10.19.02.12.58; Wed, 19 Oct 2022 02:13:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q8qWE62u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232850AbiJSJLm (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:42 -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 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106717348725507?= X-GMAIL-MSGID: =?utf-8?q?1747106717348725507?= 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/platform/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_device *xdev) { struct device_node *ports; struct device_node *port; - int ret; + int ret = 0; ports = of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports == NULL) { @@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev)