From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 67FED5FDA7 for ; Sun, 21 Jun 2026 15:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782055075; cv=none; b=u8n6fPuY+9K/VZUW9v9QJVXfjApUzJgoONzfp9a2SRPpnyqHDRE/H+oxjsOCRgPUcaJenMz+qcvfL4r/gQAqfz08WjbBdbEb+/cG3VV5O+XpO1hUwzdqVb3xP46xg8C37ppvc8IdSFdCfRDwq7bNaFSKyHyzvggn4YAkBCe7WG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782055075; c=relaxed/simple; bh=AFMdWP0PvYxRZipifLaXQSKrW402sYJXklwucS2Go2U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=V9fz8JoBiy0RdYkBmpbk4d3vrUPX+Y+M4SWkqdUaFal8PBBIS1TCp12yFUQmt3EYoOOR1dvU6G34Hmg9qPJfuIspudfnVqjzgq9sVIWnFLL/QugFEbnS6G5F0sP/rwby4x9b1zh42PhA8S6o1olghFz+6uLvF6r5stQCj0Fuqh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=BZC7j9DI; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="BZC7j9DI" Message-ID: <24e2da5b-82a4-4889-8b62-5f445cec9657@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782055072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bmM+1wEfF/WAJ5tf+v/LsFKI13F7EOzAierbj0hp3Hk=; b=BZC7j9DITI1xLCVWoBIvCK5EuEZevgBor8K76v2O1UjAq1aRGu5/KRlSk0OUQ4F12k7kBp 4AeXJCGXazHmZyZymo2XIMm4OplOMWgA4oRdlY+1FclDVgsX70ATiLMZV26qayMTEsOWn5 EuNeFfloggg6xmFSCDwhNUjrvSJnfc4= Date: Sun, 21 Jun 2026 23:17:32 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v1] irqchip/gic-v3-its: Fix OF node reference leak To: Marc Zyngier Cc: Yuho Choi , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260619185808.1090575-1-dbgh9129@gmail.com> <877bnt8u5k.wl-maz@kernel.org> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zenghui Yu In-Reply-To: <877bnt8u5k.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 6/20/26 4:59 PM, Marc Zyngier wrote: > 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") It looks to me that this issue was introduced in fbf8f40e1658 ("irqchip/gicv3-its: numa: Enable workaround for Cavium thunderx erratum 23144"). What am I missing? > > 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. > > 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; > } > Reviewed-by: Zenghui Yu Thanks, Zenghui