Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp550395iob; Fri, 13 May 2022 07:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzye+wZQGk6FgEtf4y6aNiZFfg+ni6u3iWjeV6h73iNcYda75+QzSwHdaMxkDSRjhBNIEW/ X-Received: by 2002:a17:907:e89:b0:6f4:98fe:49e7 with SMTP id ho9-20020a1709070e8900b006f498fe49e7mr4472775ejc.425.1652452055805; Fri, 13 May 2022 07:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652452055; cv=none; d=google.com; s=arc-20160816; b=t7yItK7ZGrUR0iT5du8WkLj24G9kTNxT7Q3r+xYfLgE96oaNu/+19UjLIQMA7C3f3X wjinir6I2G+lof6jg5s5MLdPIGy4JGNNj5d+zZcdjnUCs3Yid78j5k4C4kAFtamrbPL4 SlLItYASbnHIPvAnlboviIvGOKFAZXGzsYu7W2o+e6kFTAdi3kswu8hWJy78KtKMCQ2c s8ahGFDG4peJsTpWloPeh8qC/QNmXQG1vDj+N7TxbmJcSC0RgPUwbGMdwhrOWOP6KBkh blL48+F99IOdgrXOQ9ZKTtuZAhQkWhzf92OLZfUdquWEdpz+/Gf+FRG2HugpmxJ64WCk RXBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=Mm7jxfMNhSHoOx/ZID2lS2uQ78hDW5n0PiD/ELoJYIA=; b=RHihPXdNNwfh+Qo0q0Qar+ui541CzlRZ6y3e9fTk+4giHeeBS8iPWw2hHE6PZ5LbtX jF9JqAQ7XxN0+Blf/A6c1w/05JaU1zprPF1ozevI0K8MZupM1O/NpDBGzpuNBEoiqN+9 H5QNhRNbi06VVzEqJLCOHcWoc5CMxy0f788NubQyIjhDR8JdFke8rc9XJR+LEHn5GkO3 6j7Go3jvyJ3wsGfb0xDLsF9Jb8yc4Lx6VHXWHeQfprm2uz5hmELfzD6sWqKJzMVY2F5J DO/0LQxduGEtZUmlbXk8R3t1xg18jx8QVPNRU0u4zlWHPOeGWBDj6BrFZi3TjYyg0PQp w4Rw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc17-20020a1709078a1100b006f4ab13f1desi2149190ejc.122.2022.05.13.07.27.08; Fri, 13 May 2022 07:27:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356143AbiELQ3j (ORCPT + 99 others); Thu, 12 May 2022 12:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350699AbiELQ3f (ORCPT ); Thu, 12 May 2022 12:29:35 -0400 X-Greylist: delayed 599 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 12 May 2022 09:29:33 PDT Received: from 10.mo552.mail-out.ovh.net (10.mo552.mail-out.ovh.net [87.98.187.244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897091BA8C2 for ; Thu, 12 May 2022 09:29:33 -0700 (PDT) Received: from mxplan5.mail.ovh.net (unknown [10.109.146.228]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id 92B1024EA4; Thu, 12 May 2022 16:14:18 +0000 (UTC) Received: from kaod.org (37.59.142.101) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Thu, 12 May 2022 18:14:17 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-101G0047b61092e-eff4-4052-83bb-9054023d8a3d, 72056902518AC1F5BD4797AAAB6E76FEAFBFF81B) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 Message-ID: Date: Thu, 12 May 2022 18:14:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] powerpc/xive: Fix refcount leak in xive_spapr_init Content-Language: en-US To: Miaoqian Lin , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Nick Child , Christophe JAILLET , Ammar Faizi , , References: <20220512090535.33397-1-linmq006@gmail.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= In-Reply-To: <20220512090535.33397-1-linmq006@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.101] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 89c32f8e-8e1a-4e55-a27b-1b57f752691f X-Ovh-Tracer-Id: 3628212452218538799 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrgeejgdelhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgihesthekredttdefjeenucfhrhhomhepveorughrihgtpgfnvggpifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeeigedvffekgeeftedutddttdevudeihfegudffkeeitdekkeetkefhffelveelleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 5/12/22 11:05, Miaoqian Lin wrote: > of_find_compatible_node() returns a node pointer with refcount > incremented, we should use of_node_put() on it when done. > Add missing of_node_put() to avoid refcount leak. > > Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrupt controller") > Signed-off-by: Miaoqian Lin Reviewed-by: Cédric Le Goater Thanks, C. > --- > arch/powerpc/sysdev/xive/spapr.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c > index 29456c255f9f..503f544d28e2 100644 > --- a/arch/powerpc/sysdev/xive/spapr.c > +++ b/arch/powerpc/sysdev/xive/spapr.c > @@ -830,12 +830,12 @@ bool __init xive_spapr_init(void) > /* Resource 1 is the OS ring TIMA */ > if (of_address_to_resource(np, 1, &r)) { > pr_err("Failed to get thread mgmnt area resource\n"); > - return false; > + goto err_put; > } > tima = ioremap(r.start, resource_size(&r)); > if (!tima) { > pr_err("Failed to map thread mgmnt area\n"); > - return false; > + goto err_put; > } > > if (!xive_get_max_prio(&max_prio)) > @@ -871,6 +871,7 @@ bool __init xive_spapr_init(void) > if (!xive_core_init(np, &xive_spapr_ops, tima, TM_QW1_OS, max_prio)) > goto err_mem_free; > > + of_node_put(np); > pr_info("Using %dkB queues\n", 1 << (xive_queue_shift - 10)); > return true; > > @@ -878,6 +879,8 @@ bool __init xive_spapr_init(void) > xive_irq_bitmap_remove_all(); > err_unmap: > iounmap(tima); > +err_put: > + of_node_put(np); > return false; > } >