Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2161008iof; Tue, 7 Jun 2022 21:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz57FAO0q71tzldvdw3GpotAE3CYTfC//kNoh4wn4qOw0E7Ypth7lcGzbQYSKhQMYLap6AW X-Received: by 2002:a17:90b:38d1:b0:1e8:70ed:1a47 with SMTP id nn17-20020a17090b38d100b001e870ed1a47mr18383645pjb.168.1654663642057; Tue, 07 Jun 2022 21:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663642; cv=none; d=google.com; s=arc-20160816; b=uoYjoUOxqOB01098fLALOSOzRezQoBQ4o1L9brjttrKnw+fb9IPeqAnhIJeg45RjBW HYID/26M85EnlGi4GEQHcdsO/K707zTi8V/66Qs9YXUlTTYY6IblZ8xLmcuF9elbMBXw /BuBBBTVizD5AWjJU5SIZSj92IAJ3L0jp95YiANGnpe+E0hUcCh4Hi1FjRoIBJmW/hwP Iz+ACQPd4NvvThe6p/G6Pdl/9R+WiUR2i1DB9iUGk6tNxNIjqFiVe2sK0gmv7O6hZ0Sg UN7cQ38BN61XUVCmed2YT6BhqqEIQQJsgajcGd3/SVfz2awaashe8sGOxXdhF6aqhcsh JS8g== 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=gBHlGFMEgmzjy2v+6QXOt1yYuu5VnGjkoTxLxKKz/mY=; b=bZZjiP8woCoLdvdo1Hx22JFIjSBH4AV/KLZhmr9fJLCJkmkfgiZGakYvuIyHbPXHTM gCswCToBFM4wmScnMX09UGn0BOzMpXV03FGLLmvBNKT5ZBndhnQuXqeQFGRb12n45DB+ dw6Aryobg27AyinnF3tkuuSNa9kvoN7nZ0/H27DUVHr921EiRuCDNUNFhSxJuc9DM2BT PLutSXQK7oUd9XUBnmW1v9WnkDrdc8QlSjQf5DTxDzhHjKx6X8HX2kiS76GpcMg2UoOR 8NQiAIJz/rshD+2Nu/LAWhWD8sMAmP+wIwr6N4Mh+azulztWYuBZ4JBBV/dQT5yznrVP 0hQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EdBuuDd/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u5-20020a170902e80500b001619aaf38casi29201156plg.63.2022.06.07.21.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:47:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EdBuuDd/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 49BF9450172; Tue, 7 Jun 2022 21:21:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384430AbiFGWZc (ORCPT + 99 others); Tue, 7 Jun 2022 18:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381371AbiFGVRk (ORCPT ); Tue, 7 Jun 2022 17:17:40 -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 7409D2228C7; Tue, 7 Jun 2022 11:58:47 -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 3D61DB82391; Tue, 7 Jun 2022 18:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8974BC385A2; Tue, 7 Jun 2022 18:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628324; bh=nDm+GwDgvJjU1T4VnyQabcgcfISjgZ8P6P4og/v0WJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdBuuDd/+eqoke2WVzJXiBt4ngWA1+yYjxVcdaDIDFaWQxINmnlzXZgthufHU7TOj h9H0xv21Hs/Wi/vI7Mb/spKiiDPlc5N3T55B1DrEw40/1P6UepkicTQltBgtxGTJjd XC+Hcb4Z53czd2gGM/pGiB1li/l+2SCX/BM5/eyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Wu , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 247/879] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Date: Tue, 7 Jun 2022 18:56:05 +0200 Message-Id: <20220607165010.021667638@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Peng Wu [ Upstream commit 57b742a5b8945118022973e6416b71351df512fb ] The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220425081245.21705-1-wupeng58@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index be6b99b1b352..9a02aed886a0 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) } /* Initialize the DART HW */ - if (dart_init(dn) != 0) + if (dart_init(dn) != 0) { + of_node_put(dn); return; - + } /* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) /* Setup pci_dma ops */ set_pci_dma_ops(&dma_iommu_ops); + of_node_put(dn); } #ifdef CONFIG_PM -- 2.35.1