From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B54F338AC96 for ; Wed, 13 May 2026 20:57:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778705848; cv=none; b=KJDIdVVOwszK9ZY09Apx26bAcCUrlJ8qPMGfM5lXlWkRYYSiY8KIblZS/K6GC/rN8vC5edev70yvU+ExPV8ufOUokB66GU/e2swsHsipptps59k4NZdTW/xTHm+tg4E2cDupQTSUiMYDji1/3RIhHXYAxHbDLxM5Fw98MLVErQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778705848; c=relaxed/simple; bh=Z9Y+Q7KOLBtKio9htuK6D63wNUz2XSwwT+wbn7ObaBY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nNZhCL/hx0lPIqvKjOj+EjaJiHd/pEQ0uQVdfp7q/1P1cghjlTPcp3aYmPjxSG4Js308ewgRWq++nLZD+Ks2BpgFIeeMUA4jy/SJ4I/bu0b7CVTy7yJCkT20aj7yxwNPnrqtzJ5mUf8mexliMhLTHJaKiVhwBblrKi1wL3R1GIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KeMUk4UC; arc=none smtp.client-ip=209.85.160.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KeMUk4UC" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-50e594413c2so47168401cf.0 for ; Wed, 13 May 2026 13:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778705844; x=1779310644; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oKXnHxcGKyEItz8+qPNqFMSPcNy9STP0W4CtPGkebJI=; b=KeMUk4UC1zmr2mbykwRjn0vrVT3Cg2M7Kc7XEvDAJpjqvaJ8QdauQKeOWVWthJO+jH gKXgMpivv4vIhwwBUdO/6Z+VV1RY0/mJJZ4+fiyUQgRhnlNQIJZl/f2MtLBzrWjZc4U3 V5k2zRAeldkfpA+D5z0pxmo5E0bWqClRo3LPDCLOL9seFV0NCPonTUNJfZ+h4mYzCkV0 kH2w+2t1+mJOCVNRrCH2RnysGt/fPLUgrFy4vRWQMwr2gPPA1/wz67IJLj7gB6OjzNT4 ZnugZYORokXQ5mbOArAqAgvprb+v2yH1yRJal5NDI2MFapnDR7Vza+GacV6d/qIT/fAn MbWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778705844; x=1779310644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oKXnHxcGKyEItz8+qPNqFMSPcNy9STP0W4CtPGkebJI=; b=UX6+vWpqQNP8MdmtbsdjMk4ryRs30NAu8oS9+TJKod8ob3CEqWSiDtFDZvvC201rgu YLYcqyQnD254E9BEg1UUu9FXiTwuEG+Tye0Qi3kmm6gHV1QAlaz2ECK/5FSaAreQWBfd vT/kmzIZe1WaXz7YQnxRmUFbZ6UQ/5fLwDFlZAwntchMcXdrBfnY7ZLd5FjCZyVjXQoJ 7JMSHtfqythouqNNmMSsOB0mJVEi3hZTI+0rwGFidwkRFmSG9BiOtVf2Rg0P6SBGe+E+ kxDlUoJrmknc8gX+//rGrDDOn6KTh6ZuazsSyYkvMEVdrFORFGogiDODVdcTrRtClaZ6 oUIQ== X-Forwarded-Encrypted: i=1; AFNElJ+FRr9j50hYvI8Gdr66cq7TV6HHurhXkHo1HT+ajRaLfk3AIDMRLMOYHQO09Jm1fY+AIW2tkT63SOtw9RI=@vger.kernel.org X-Gm-Message-State: AOJu0YzX2Cu+IEpXpAPKAnD/xCuzFjQGB32KqpW54rUygVDiaJO0Eo9E y/cRrbIBoCIKS8MZ57j1Q53ioxLV8s50Tu/6ASk8JGIGd9fC6NA1j6Y2 X-Gm-Gg: Acq92OG4rZ/JGoF6bJgJdvrRSBPVgrIK1rV1v5GxSWNkwAtU2zB+xUhLa19LZtKYy7f cgHyd9NZ621sdktzg7d0tu0v1SeZu77Q/n1edtC4Q2Jps7AVzNzU/gdqp3LClrY4mha6dlFwkH6 +g3I5zj0G/psrmB7J1ncqxebxTr7UMi8M6ddvI07b6KKUm0v3NFgkCo9ns2Cxv90+kZjjFgu0Fi iwyqYIjA2SFkC+1sf2n3Apbos3NQDfZPfTZBT2yBGpvdcpjnbH92+a9UyvzfJYIljm3OBQJu3dd Xp8cJFNB5N41x2giCvst/PeJG5tvij5PKng95vTqsEcldSbP4BbLJ16gcCrfa/JwahGqgbrPVfU 6kl6n2lk7Y54uMuzhh1ZBVlnvMFjXu53809hw4YXWl49H/DhYV57wNseZ7lbo3ZDjc7XZO4kLCL OT0mE0NsjmOPcMQtuW43UqOPyEBiJmD3acKbPnuphv X-Received: by 2002:a05:622a:1209:b0:50b:29da:ec58 with SMTP id d75a77b69052e-51641651eadmr15939811cf.8.1778705844388; Wed, 13 May 2026 13:57:24 -0700 (PDT) Received: from i4-gl-tmk5904.ad.psu.edu ([130.203.156.186]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-5148e7e3d90sm152940931cf.20.2026.05.13.13.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 13:57:23 -0700 (PDT) From: Yuho Choi To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yuho Choi Subject: [PATCH v1] ARM: devtree: Fix /cpus node reference leak Date: Wed, 13 May 2026 16:57:20 -0400 Message-ID: <20260513205720.638900-1-dbgh9129@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit of_find_node_by_path() returns a referenced device node. In arm_dt_init_cpu_maps(), the /cpus node is kept across CPU node parsing but is never released on the success path or on post-acquire error paths. Route all exits after the /cpus lookup through a common cleanup label so the node reference is dropped. Fixes: a0ae02405076a ("ARM: kernel: add device tree init map function") Signed-off-by: Yuho Choi --- arch/arm/kernel/devtree.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 3b78966e750a..88a072d3b8e1 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -93,7 +93,7 @@ void __init arm_dt_init_cpu_maps(void) */ if (hwid & ~MPIDR_HWID_BITMASK) { of_node_put(cpu); - return; + goto out_put_cpus; } /* @@ -107,7 +107,7 @@ void __init arm_dt_init_cpu_maps(void) if (WARN(tmp_map[j] == hwid, "Duplicate /cpu reg properties in the DT\n")) { of_node_put(cpu); - return; + goto out_put_cpus; } /* @@ -149,7 +149,7 @@ void __init arm_dt_init_cpu_maps(void) if (!bootcpu_valid) { pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n"); - return; + goto out_put_cpus; } /* @@ -162,6 +162,9 @@ void __init arm_dt_init_cpu_maps(void) cpu_logical_map(i) = tmp_map[i]; pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i)); } + +out_put_cpus: + of_node_put(cpus); } bool arch_match_cpu_phys_id(int cpu, u64 phys_id) -- 2.43.0