From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430334wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jYy7kBgo1Z8AujaeQWA1qDKLCsymeVJboPJtcCLPUCgOVj79JV5mx6j80Khe93ijFzh9b X-Received: by 2002:a63:5b53:0:b0:462:7149:2c54 with SMTP id l19-20020a635b53000000b0046271492c54mr27522174pgm.527.1666615275575; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=SzP8w9pdVv9IXj8xWvDv+dTP2oisquKoIDrohe6/9oiPJHfiLKYg/amnKhtSMyP3d0 a+n/X6FqKlHbi7PvLOFx3MYUVii6qgZvs4LeiOwhGxGlVGcHXLdrCqW5Y3AseQMUu9pn n0FIus6BYrn8biww7neIxCWH6YuPAiMy7NeTKnFDDPiRyRylMawpGnZD6TDfNf9XkjnJ 30x1QasrL24ttFaYXL7VQ1YGHD+4PUq1Swq6X5TxZfvp+xIIaHTZVmgjxkfIvCC55/bI nhhopIyczcNVXRyvbW+FjbqSYtXXRamrqWJBruJcL76gsy0PaTwZK3p5w9/FgSbe/Zth 9v4Q== 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=TQ5MctYJvG9FFzJbfOy2QumdHa1ZDUrExA0o/pdf2+U=; b=wLJnALtRYtDqJyutcSIUquVg9Sqni2KY5rVHww8A+ieQEE7oYjpP8asZTfxr14XUYE Uxh3fGScTEeX1wPfFViEbmgHSDCDu8NkBsC25c4f8RM06EauP+uOa33TrTznouQ+wlcj jDTX4ljIRhlhaTRtSKBnaQ/XIgyy1hnoylWT1iyWoa5rcnOI+hcp/WVZRRNAgf3QAMdN wXPeTY7uhw11wwxkAZ1/7hRqdLRe7ZmzCM2XECPIAtRLTgB5vXXTRr1CG20/jlL5tSF+ 8BcOQ71L1Ok0mTq3do5t4EPd9Yj/hGcrcNELPAVTN3+6fyaocPexIBmsMY7PwgiofE1z 8nCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tRIQGIRB; 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 w6-20020a170902d3c600b001783af487d1si31270154plb.533.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -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=tRIQGIRB; 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 S234014AbiJXM3L (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbiJXM2V (ORCPT ); Mon, 24 Oct 2022 08:28:21 -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 C2A3786801; Mon, 24 Oct 2022 05:01:40 -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 F371A6127D; Mon, 24 Oct 2022 12:00:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 175CCC433C1; Mon, 24 Oct 2022 12:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612814; bh=py1Zph9NUQ/OJNirFXbkvul6N/qlUoss8U2ugj+VCtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRIQGIRBZthN8AeZx2X77+0HVeCvFbSplqpdMJqPiSsLSvhsT6BWkqZAAT4y/aR32 F888jRoKAX457Fvd8Z2oT623zdY91F03xVZjY0t7v+sb4DJGIqq8PCI42C0v4qt+K5 t5ZIxAGW5iiK6SH+5wlrHDlZkq0RPoL4ZAFQC1YI= 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 4.19 130/229] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113003.210505896@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747572779327656197?= X-GMAIL-MSGID: =?utf-8?q?1747572779327656197?= 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 6d95ec1e9a6b..9177db789b07 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -464,7 +464,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) { @@ -474,13 +474,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)