From patchwork Mon Oct 24 11:30: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: 10040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622623wru; Mon, 24 Oct 2022 12:45:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QqOKR4tKxPLaAsYn2KJiDcqvnjpr0mYVBjJ710xMl9C1yJfyNf13EeJwkQA5ADwL77omy X-Received: by 2002:a17:90a:fe5:b0:212:cae0:7482 with SMTP id 92-20020a17090a0fe500b00212cae07482mr23243797pjz.108.1666640757567; Mon, 24 Oct 2022 12:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640757; cv=none; d=google.com; s=arc-20160816; b=gRxOL8O9kUCSRzIGEEwqAYbRgOAMrY73NG0LsjiIAXBqeG1VtpEueIiWrQE2EnRfPH dA+dGUDHiiNCuP/XLw7Y3GAOXTWMgt70aSXUVl5NA9vZOUxjGtK5WfIptvZI6Ow2/SAx bQegzKSiTArkhAbjFLBhQ/cNXOY38DpfAvbddSvr2qSVjJG7k2Up8K3mf9YovCspRY25 384YwLjeSIcmT84sxxVx2Dd2SM2bM50QsJG+KqoQG8C3nIZrPQJ6XXUfWkVXEl7pxF8L rKOfD4VSXp/PB6dq4Au0REI02Af2+vskY8vUusWLzPHoT9B7+MWQri2PY/cG7BH49c3q J+SQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a170902d4c100b0017f97fe778dsi584849plg.126.2022.10.24.12.45.43; Mon, 24 Oct 2022 12:45:57 -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 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?1747599499002000139?= X-GMAIL-MSGID: =?utf-8?q?1747599499002000139?= 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)