From patchwork Sat Oct 22 07:24:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098441wrr; Sat, 22 Oct 2022 01:10:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ukORCnIebGZzb9Xp8SOD0e0ay7Qygy0NZw8TXpV3zFOjMQ6WIHnTKUVPiMntvP78lJyFZ X-Received: by 2002:a65:464b:0:b0:42c:b0:9643 with SMTP id k11-20020a65464b000000b0042c00b09643mr20136859pgr.232.1666426250243; Sat, 22 Oct 2022 01:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426250; cv=none; d=google.com; s=arc-20160816; b=wm7BuR8V44r85VEXIipoH8PWRqXx0rcMsqcuQD+hstlUTPpowLLLyljPE1KaS/z8SH ATzoIZ3GwcmvW1PTTxKed5fjkesjcQd9yCz/4r5h3wvDRcROy7p3hovj5IM6X7WOtq0Q CFutSPGuZK2civYt4f20Cw/DB1xXqN4N6CmVQY4coBtWfumcQEbA8fyMO2cLdXyB0hZW pfDG99N5/wR2CTt8lfs4GUcKtjOEE70OEc/UmAIJcUOB0JlzqReCoLQtpQr6zyX63fTS nf3LUxZ4PffEEgPp2ZiGZ2FxH7qHmv2931z59G3n/iKxi67ynVNb4SueZWqVP1H6OG9p pDxA== 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=Vg/dR2rKvf6KC0L0skIrULYJnhKK/k1x3TmaKfptjm2dmJ3Ssi20A4IS7V161328j4 0NYJUFHauOo4Aadu1sKT9BmGINVpX08eit1dQOxe3QLdS2mxlV0yqv140yW0NRYT0ugJ AKEbyF/k++jgh+D3s/qnr+48/KmfW87OLFHfPP1/NGqukuHBXO6VOsRfOiPULp9/fEhC QvKpOPFdWfhKb5HfEEBJhv76g9akq77wKnyCp60FQNQEIxwY73xjJSyG/yUF9Ow+rKBa 4S8wD6Z/dfrPz1FgAyMUad/uHM8aA7sbAzTS8/kIRDA8rkPu7QGA06kNAcg1KCeTYwJ+ GCdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j07urjt1; 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 m18-20020a056a00081200b00565de49c28esi30478543pfk.57.2022.10.22.01.10.37; Sat, 22 Oct 2022 01:10:50 -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=j07urjt1; 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 S233429AbiJVIJu (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbiJVIFV (ORCPT ); Sat, 22 Oct 2022 04:05:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E152C6E0D; Sat, 22 Oct 2022 00:52:46 -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 757BAB82D9F; Sat, 22 Oct 2022 07:52:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A78C433D6; Sat, 22 Oct 2022 07:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425137; bh=nmvG3vBy2Gnd/UxyKgj0D3lIpS0zVnyNZ2NZnicV560=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j07urjt1Ot1jNuQnTZ6vY+AMuNmZKB1a66DGG2Bp0vm2h+ShN6yO/we6k6QVyXYdE AYrL/k8vpeqWJUUtO5A/sUZWHBnrJUafqlE9Advjsk7jrn+apq5+PDbJZQbl5/7DYp uJqIi7fseLSKrziH2g0qYHSJDuzctpFJeJshhy5s= 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.19 403/717] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Sat, 22 Oct 2022 09:24:42 +0200 Message-Id: <20221022072515.722008557@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374571489429931?= X-GMAIL-MSGID: =?utf-8?q?1747374571489429931?= 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)