Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7350797rwi; Mon, 24 Oct 2022 13:23:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eWjVr6Y3Uc86PvWZ2Gzt27wGIwJMDxePdc3EYhmmIbUunWjA8vCpn8uCz25yysPxZzrLW X-Received: by 2002:a17:907:2be9:b0:7a1:11a9:1334 with SMTP id gv41-20020a1709072be900b007a111a91334mr1132877ejc.131.1666642983850; Mon, 24 Oct 2022 13:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642983; cv=none; d=google.com; s=arc-20160816; b=WWRNN/AzcK5iCF7CYDelAtWyb3gUMZefvQTjSMf7VnP7fU6JCTaGEQ43UXqHxLFCP5 8hxiDG7Mgiy9r6zaIIInyyThG7zCWQL9hmto9hTkTlSaC4oOpznasVP2yPG3phdJIL8J E61NcNhVwr3cGwkJGDtc8WW3jYZqKyGAs0W5xCWQzklqRpzQAI4SJ86SL3WuFqKjpYCa AX1vssSvmyNxe/rVZ3+oBquCOkXr85DXIcw5cWJ9eszrhZ4PFW51oxvlFGn+O6QVH4U9 jSjHH1CW2nyaY0vlX/J06HrnrdmC30+JLqViAm5iQyztEIsK7MhB6cLVEf3noaSYMjzA eA3w== 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=M23wcigC0/d0AegHseZ6cHzi3psVYhi2LdOr4zM1Mco=; b=h/K+Q52YHfHQqjwBBSwPYiUpda96x9QQLrpXDuxrbeNHfPDrDBPJ6k5f7tPOzbXKXB EK2D59Ohv7WePmpenqNsnvlsuxINjx+l0Hp8CcxFjGpi7+o4/LDjyqPE/vt2d9vecE9b rjFAzq9n3yzR1sn6NlPzlAk0ffDa3xxch90FFEZk43hXu9I91jtg8DNWvCNyW6QY6v7L vWXsqxg+fv2OUqtMZDJU6kNGlkfw5wZiQxtEV8CgMbvWnWgP5LhZxywRD2k6IAWdxuEf +owZZM1ggUlPHc8N8BOvQPqYPC1I7XJyoAyCB9YjUSwGmyx7OneVLlN9eJYljAXiNBfb eKSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qx7oyCJD; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b007a8beb3aa4csi696935ejc.872.2022.10.24.13.22.38; Mon, 24 Oct 2022 13:23:03 -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=qx7oyCJD; 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 S232571AbiJXTnc (ORCPT + 99 others); Mon, 24 Oct 2022 15:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbiJXTlw (ORCPT ); Mon, 24 Oct 2022 15:41:52 -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 918EF72950; Mon, 24 Oct 2022 11:11:43 -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 B68F2B811B1; Mon, 24 Oct 2022 11:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11961C433C1; Mon, 24 Oct 2022 11:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612247; bh=rBtdXM8NAjClPCybzEt83MAkGsvsxCIWqSrzQx2wJQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qx7oyCJDgu+a3Om+mtUT6K3d44jRrg45X84mhC1Ig1jKqxCzIVZoLBGs3gT98lPDy 1ksK7N9clj2y2aBAxGCJxYKnMedImBD6ERfmvCXlfE2bDjDkYV3PHQic0NHSAu8KVi WrbK6hOvOBYlVnJZb/4U5QE8QtQDR+By8jKZV25g= 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.14 125/210] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024113001.027245520@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 ebfdf334d99c..7e0d7a47adf4 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -467,7 +467,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) { @@ -477,13 +477,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) -- 2.35.1