From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4938B40D566 for ; Sat, 20 Jun 2026 08:57:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781945879; cv=none; b=Mm8rhSojCDAKSrcd3UTz/ZRdfeE+w1ZtT44ll4J36GERRi+N8A101OmT8SquVj8ggnSSCsqh30flVWK8LC/mh8/6YIHBwCoFxqhgExep3cc7Ff/jg2hdEqQsl5xDSqgAJGOBmtlwOV0K4Aha2fMHeyursI5B9dVWbL56jdS0ZmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781945879; c=relaxed/simple; bh=P33u0cacw8ueswUPC2/zr1/JlhaxnoLYtj4IBTuipTE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=Ip61LNQ/bfnnmg9hqKyPEV3t+BVrDCb1XSjRMUxWHDwr4fSlXQaJVk1MCvgnTpUxznwydtA5DqwdAezzjsqhUb5iYi+CymQgiAJX0w5rRZsMCLPwWnVyG4XTtgb/fur7PSNJRSrcleLZNLKqFvQttKwK8Bp/Ms1oAlLB2wYD46E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FlZF3pr/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FlZF3pr/" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.