From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30CBAC433EF for ; Thu, 12 May 2022 16:14:55 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KzcLP3khYz3cK2 for ; Fri, 13 May 2022 02:14:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kaod.org (client-ip=87.98.180.222; helo=9.mo552.mail-out.ovh.net; envelope-from=clg@kaod.org; receiver=) X-Greylist: delayed 165584 seconds by postgrey-1.36 at boromir; Fri, 13 May 2022 02:14:29 AEST Received: from 9.mo552.mail-out.ovh.net (9.mo552.mail-out.ovh.net [87.98.180.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KzcKx3SSDz3bxS for ; Fri, 13 May 2022 02:14:26 +1000 (AEST) 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-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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; > } >