From patchwork Mon Oct 24 11:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459318wru; Mon, 24 Oct 2022 06:39:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/+KeOGstXYoVJ/yIacRYZesxArQsP0g4Hy44D2iTpaFFn2p5qNJoQlijUvFIrEhc3eT3p X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr30091187edz.406.1666618759809; Mon, 24 Oct 2022 06:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618759; cv=none; d=google.com; s=arc-20160816; b=utaDAw9EY9rh8KE649YRTw/cMQHyO7JtwtfXZEhwfCVT2qx35N5f0MOZDSDW1m9PxB hBUWgZ/ypk0jOi13G90EnfAQSQoQNaSkOoudWmP4wLvTLdYbXvBr1z4i7D4gI6PwTDIh rYFznrw1wT1FXKl+f9bd0eqSZdiAW1DEPUPlkqXMkJheV82L885UkkQamzTTysJO58Kx W52/R1WZDpBYbhISM4dTf2DYjN0/tFrL14DBtg1QmRvysHL3fEdIqeGYDzUZMo2PYh3e 1RzdHQNNQNXX1NuJCRTInsK7WENZjgxjBty8FX6uZi57QlrbuJzkG4ZcTcZKaeiAIK8B A35w== 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=rmOBNfZQuM6fDzJ5MCye9A5aZzt4QByqpmDDpkiSopo=; b=EVI2fLRPEpGILV1LsQw1Z/Xhhy/WU4VIp7zOjLlnHmJKd8zeRS6lndRaXhZ4OTbU1e WXlhWJNV5VhaUSpYZ62riFq6ew7OvLL1tN1hiO1984wadA+aQUfXpnrVe2IS/slC/z/v 2B4FPVewxvlRn86ySlPjJQgREZnyk0mIAleK3yob/clMze5nArCFJcG34cpUYBwYJUyX h3Sgbo7IH5XnEsKSiP0tVW/SOC06TYOQITcVhWBplrj2RWj2t+dcSS43zX56Yl7kzD6f 1Cfhc+1rK1lLj+mmj4GIpAUpWO2bvFlyllNY3gEv0/YA3qvwvLW51srxZhODAhnctN0K FPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lN+9P4cZ; 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 t5-20020a170906268500b0078d38cda44bsi6718510ejc.694.2022.10.24.06.38.54; Mon, 24 Oct 2022 06:39:19 -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=lN+9P4cZ; 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 S235986AbiJXNeL (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236199AbiJXN35 (ORCPT ); Mon, 24 Oct 2022 09:29:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760A6AC4B2; Mon, 24 Oct 2022 05:33:19 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4EC71B815BD; Mon, 24 Oct 2022 12:10:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A608AC433C1; Mon, 24 Oct 2022 12:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613427; bh=oYRhmtQE/klOFsQCHCsRhaWDY77M6fjbrOG794N8IJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lN+9P4cZCntknjUGfcRbTfsww9N6PoQYfl/7HL0Tsa6yfwKt1WYaatQRkliJx8eSX UgYDjZZiszSdJRQJj06R0NGP60CC1WWCOzzge6Xq3IZpS7lsMCvE6qeOmynlMuyKmm VbqjS+vfRICSK+50gRwd4yrLLMBF6Cq5nMiE+qm8= 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 5.4 133/255] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113007.001252156@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747576432836954523?= X-GMAIL-MSGID: =?utf-8?q?1747576432836954523?= 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 cc2856efea59..f2b0c490187c 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -472,7 +472,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) { @@ -482,13 +482,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)