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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8BC49CD98E4 for ; Sat, 20 Jun 2026 08:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fmHBGKXtvGpA1nsaRuGHY0rfMBcfLnEextl+zb4B0cA=; b=pVFdK2H4o/3vACujANtzx1HEio gQIVDNdjragvyNwU2rQVqwr03C2xDcWDZgamrs9zyYZbIxhWQf03DxRjs8OY/tKRfY0z5XYmek8bF U2MkDfSrVYmPET0iLX0Uh3m8OYhhwJ91WOcJ/G/14M3ZdjnmaP6JDqNryIcpAaLiSzH7Hxt2NoXwY bgVTtoCwtpCLnAJ7DT1cFau3TOozQbPILycW0ROYmRL708FbpTfTW/7TcoFWEVoDJvIuWxVJaoplN 2ek69SJb6NdQXXIDNcimBZCsDMiRRHPy7O69Q+Jm12rUGQtmOwnsOvKhepM0mexB2iCYgsSSNNq8r i3pS/XhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1warWa-00000003HpV-2Fq4; Sat, 20 Jun 2026 08:58:00 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1warWZ-00000003HpO-3GVN for linux-arm-kernel@lists.infradead.org; Sat, 20 Jun 2026 08:57:59 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3F891600AE; Sat, 20 Jun 2026 08:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E85AE1F000E9; Sat, 20 Jun 2026 08:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781945878; bh=fmHBGKXtvGpA1nsaRuGHY0rfMBcfLnEextl+zb4B0cA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=FlZF3pr/qsb1qGAxsh0Ud8PKxE3rRCRwNMbEWzZy9eUvd69+2QJAdesZLH64aMzd7 JYm1JIAGvs/OgmsN0ds/urwDf8DMiwoUWBD23XB4nF9cB3epB4fxNwvAuTDmgvrVec hPFTDNmElhWuLxyti71rgQon0Z0Xz6zpEAqjMk2jWTw6qiWMtgrh16b4sA6T0V7ZJF lKvrV1VqWZguTFG3dVlhmNY926nfkmZn/AMPkJBxYUWOk2eguODQVGKUo6IYmojgDV 5Xa3SXy+NR5mUnhK26yMlIln16Ha0XtchnnodveePi9bNQFowaKtWcmJaZn/TiyonY DUfM5Rnd+zz1g== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1warWV-0000000EUVl-3j2J; Sat, 20 Jun 2026 08:57:56 +0000 Date: Sat, 20 Jun 2026 09:59:03 +0100 Message-ID: <877bnt8u5k.wl-maz@kernel.org> From: Marc Zyngier To: Yuho Choi Cc: Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] irqchip/gic-v3-its: Fix OF node reference leak In-Reply-To: <20260619185808.1090575-1-dbgh9129@gmail.com> References: <20260619185808.1090575-1-dbgh9129@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dbgh9129@gmail.com, tglx@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 19 Jun 2026 19:58:08 +0100, Yuho Choi wrote: > > of_get_cpu_node() returns a referenced device node. In > its_cpu_init_collection(), the node is only used to get the CPU NUMA > node for the Cavium 23144 workaround, but the reference is never > dropped. > > Store the NUMA node locally and call of_node_put() before either > continuing with collection setup or returning early for a NUMA mismatch. > > Fixes: 920181ce8469 ("irqchip/gic-v3-its: Add ability to resend MAPC on resume") > Signed-off-by: Yuho Choi > --- > drivers/irqchip/irq-gic-v3-its.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index b57d81ad33a0..f82035eb77e5 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -3291,10 +3291,14 @@ static void its_cpu_init_collection(struct its_node *its) > /* avoid cross node collections and its mapping */ > if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { > struct device_node *cpu_node; > + int cpu_nid; > > cpu_node = of_get_cpu_node(cpu, NULL); > + cpu_nid = of_node_to_nid(cpu_node); > + of_node_put(cpu_node); > + > if (its->numa_node != NUMA_NO_NODE && > - its->numa_node != of_node_to_nid(cpu_node)) > + its->numa_node != cpu_nid) > return; > } > Please consider using the cleanup infrastructure instead, something like the untested hack below. Thanks, M. diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 291d7668cc8da..947a15bb42012 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3290,11 +3290,10 @@ static void its_cpu_init_collection(struct its_node *its) /* avoid cross node collections and its mapping */ if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { - struct device_node *cpu_node; + struct device_node *cpu_node __free(device_node) = of_get_cpu_node(cpu, NULL); - cpu_node = of_get_cpu_node(cpu, NULL); if (its->numa_node != NUMA_NO_NODE && - its->numa_node != of_node_to_nid(cpu_node)) + its->numa_node != of_node_to_nid(cpu_node)) return; } -- Jazz isn't dead. It just smells funny.