From nobody Thu Apr 2 22:28:54 2026 Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (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 0830E3C2F; Fri, 13 Feb 2026 18:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771005740; cv=none; b=DWq8M96t3F9aniOoEIRVh4Bg1bDY6hhXRrjtenu8rn7iZvvxOwnQb6WkPLlc0w0Kb43bl3IIbza4msY9sCbJQhNH8z41jxHfc9Ay01O9NuvtiEv6RtVFzrOVvP/rgKY9eFMejb2B5uFG/rJIrcNvRvLDcAzKLf/CI1s4CCCa/9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771005740; c=relaxed/simple; bh=mXqi+ihoqe8CrKNDfS9EP0qg1F41n7FGyjapR79FGdI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=spv7yTPtIGwDhAtFpK5SHNE6Q/oPy+I4WGjENgDRqdu0tDIqHeA8Py20culOZglWpTv71oTwvGjpcqc3OPyb5NivQnVXaqKP1AIVA1M3xfPu4cq/DqnGNzllO5Dyf+DfA8piORSIzUuGEZfWdGOXcF/DdWz4RD52EBQGamBy8Ew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=T96aE1OE; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="T96aE1OE" Received: from mail-acc-it-01.broadcom.com (mail-acc-it-01.acc.broadcom.net [10.35.36.83]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id AE09DC0009C5; Fri, 13 Feb 2026 09:57:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com AE09DC0009C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1771005423; bh=mXqi+ihoqe8CrKNDfS9EP0qg1F41n7FGyjapR79FGdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T96aE1OEksIGTDIZkOu+yI/C7Gy7OZHtM4Bwea/9fyK5Ek8oZEKDCglZ6sfDtdihy xG2JiTcLa+Cb8Wk2OiWlB1hUGZtbxlc9ltHl6HDJcr5EDRm8O6T249V33u17rOHsfP gUsEClHi8THt6rr9/o7RUnbZoOJQHzXBL50XXeWg= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (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 mail-acc-it-01.broadcom.com (Postfix) with ESMTPSA id 10B59AE94; Fri, 13 Feb 2026 12:57:02 -0500 (EST) From: Florian Fainelli To: stable@vger.kernel.org Cc: Pierre Gondois , Sudeep Holla , Greg Kroah-Hartman , Florian Fainelli , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH stable 6.1 1/2] cacheinfo: Decrement refcount in cache_setup_of_node() Date: Fri, 13 Feb 2026 09:56:59 -0800 Message-Id: <20260213175700.1964980-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260213175700.1964980-1-florian.fainelli@broadcom.com> References: <20260213175700.1964980-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre Gondois commit 3da72e18371c41a6f6f96b594854b178168c7757 upstream Refcounts to DT nodes are only incremented in the function and never decremented. Decrease the refcounts when necessary. Signed-off-by: Pierre Gondois Reviewed-by: Sudeep Holla Link: https://lore.kernel.org/r/20221026185954.991547-1-pierre.gondois@arm.= com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Florian Fainelli --- drivers/base/cacheinfo.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 9e11d42b0d64..54a66e4a3460 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -195,7 +195,7 @@ static void cache_of_set_props(struct cacheinfo *this_l= eaf, =20 static int cache_setup_of_node(unsigned int cpu) { - struct device_node *np; + struct device_node *np, *prev; struct cacheinfo *this_leaf; unsigned int index =3D 0; =20 @@ -205,19 +205,24 @@ static int cache_setup_of_node(unsigned int cpu) return -ENOENT; } =20 + prev =3D np; + while (index < cache_leaves(cpu)) { this_leaf =3D per_cpu_cacheinfo_idx(cpu, index); - if (this_leaf->level !=3D 1) + if (this_leaf->level !=3D 1) { np =3D of_find_next_cache_node(np); - else - np =3D of_node_get(np);/* cpu node itself */ - if (!np) - break; + of_node_put(prev); + prev =3D np; + if (!np) + break; + } cache_of_set_props(this_leaf, np); this_leaf->fw_token =3D np; index++; } =20 + of_node_put(np); + if (index !=3D cache_leaves(cpu)) /* not all OF nodes populated */ return -ENOENT; =20 --=20 2.34.1 From nobody Thu Apr 2 22:28:54 2026 Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (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 0834126AC3; Fri, 13 Feb 2026 18:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771005740; cv=none; b=jR8tNUbhOGyqPz8J7hJRiIbPvPVFlmwfN6/237VHNUfVt/cLSB1epFHW7bVml2kXQbLBCccq24nEs44Mamw3Aj8fA8nHHsGb5wIgJMKRSjXXjJAETUPLSZ6w9T+ZAdt7RDLNmyXORt9N9I8IaGql4kfPbgYcxs0CXpQpheap3UI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771005740; c=relaxed/simple; bh=T3H/rqZoAbTeAnPTNpF0gFaeTaj6/jZHM6Tp0VHclZo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lPgDMeWaIzTJyiBe5s8zGg+HL2VhZyjWCeqsrQLs+5tI6LcOpK7NjI0qhlLkN8a8ylBOFyB/4V+EfrWf7Ie2bT+OAxlZDWbUpRZ1Wpu7rfjhu3iqo+Bn8gRMQrm+Fv9kJpMEG5ugawFuTBaB0N+ylVHo+mRvrJjFZmZyUnQO6Vw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=C+/XLghw; arc=none smtp.client-ip=192.19.144.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="C+/XLghw" Received: from mail-acc-it-01.broadcom.com (mail-acc-it-01.acc.broadcom.net [10.35.36.83]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id AF743C0009CE; Fri, 13 Feb 2026 09:57:04 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com AF743C0009CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1771005424; bh=T3H/rqZoAbTeAnPTNpF0gFaeTaj6/jZHM6Tp0VHclZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+/XLghwxfchni9o8dMUhYYwk0qw2ObvRrQVl8z4qD9STw6vjzvHlbYowwZ3NPa64 R5UYhCKr/yY183iaJQbVAr8PDsMKBkbFLIOPnwrUdtVxHoNxThkDBnYZktjp/Z+ok3 Y9zYBCL3oa/PuHQtd2MQB9FySPnWGvpBJPLoxOMM= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (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 mail-acc-it-01.broadcom.com (Postfix) with ESMTPSA id D2B1EAE93; Fri, 13 Feb 2026 12:57:03 -0500 (EST) From: Florian Fainelli To: stable@vger.kernel.org Cc: Pierre Gondois , Geert Uytterhoeven , Marek Szyprowski , Geert Uytterhoeven , Sudeep Holla , Greg Kroah-Hartman , Florian Fainelli , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH stable 6.1 2/2] cacheinfo: Remove of_node_put() for fw_token Date: Fri, 13 Feb 2026 09:57:00 -0800 Message-Id: <20260213175700.1964980-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260213175700.1964980-1-florian.fainelli@broadcom.com> References: <20260213175700.1964980-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre Gondois commit 2613cc29c5723881ca603b1a3b50f0107010d5d6 upstream fw_token is used for DT/ACPI systems to identify CPUs sharing caches. For DT based systems, fw_token is set to a pointer to a DT node. commit 3da72e18371c ("cacheinfo: Decrement refcount in cache_setup_of_node()") doesn't increment the refcount of fw_token anymore in cache_setup_of_node(). fw_token is indeed used as a token and not as a (struct device_node*), so no reference to fw_token should be kept. However, [1] is triggered when hotplugging a CPU multiple times since cache_shared_cpu_map_remove() decrements the refcount to fw_token at each CPU unplugging, eventually reaching 0. Remove of_node_put() for fw_token in cache_shared_cpu_map_remove(). [1] ------------[ cut here ]------------ refcount_t: saturated; leaking memory. WARNING: CPU: 4 PID: 32 at lib/refcount.c:22 refcount_warn_saturate (lib/re= fcount.c:22 (discriminator 3)) Modules linked in: CPU: 4 PID: 32 Comm: cpuhp/4 Tainted: G W 6.1.0-rc1-14091-g= 9fdf2ca7b9c8 #76 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development P= latform, BIOS EDK II Oct 31 2022 pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : refcount_warn_saturate (lib/refcount.c:22 (discriminator 3)) lr : refcount_warn_saturate (lib/refcount.c:22 (discriminator 3)) [...] Call trace: [...] of_node_release (drivers/of/dynamic.c:335) kobject_put (lib/kobject.c:677 lib/kobject.c:704 ./include/linux/kref.h:65 = lib/kobject.c:721) of_node_put (drivers/of/dynamic.c:49) free_cache_attributes.part.0 (drivers/base/cacheinfo.c:712) cacheinfo_cpu_pre_down (drivers/base/cacheinfo.c:718) cpuhp_invoke_callback (kernel/cpu.c:247 (discriminator 4)) cpuhp_thread_fun (kernel/cpu.c:785) smpboot_thread_fn (kernel/smpboot.c:164 (discriminator 3)) kthread (kernel/kthread.c:376) ret_from_fork (arch/arm64/kernel/entry.S:861) ---[ end trace 0000000000000000 ]--- Fixes: 3da72e18371c ("cacheinfo: Decrement refcount in cache_setup_of_node(= )") Reported-by: Geert Uytterhoeven Reported-by: Marek Szyprowski Tested-by: Geert Uytterhoeven Tested-by: Sudeep Holla Reviewed-by: Sudeep Holla Signed-off-by: Pierre Gondois Link: https://lore.kernel.org/r/20221116094958.2141072-1-pierre.gondois@arm= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Florian Fainelli --- drivers/base/cacheinfo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 54a66e4a3460..f41effceea7c 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -409,8 +409,6 @@ static void cache_shared_cpu_map_remove(unsigned int cp= u) } } } - if (of_have_populated_dt()) - of_node_put(this_leaf->fw_token); } =20 /* cpu is no longer populated in the shared map */ --=20 2.34.1