From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 2F30530676A for ; Wed, 10 Jun 2026 05:33:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781069606; cv=none; b=jCE8WMqptkFLPvnknu7RRDj3TOGDUcsWndNNVKnawQgwpviuZo6lmCuXdxdDDfkp//xwYvopxSRIEQ8fOP8sup1CKHazFBODTolo9ap4uqU8jL6ZaViFrMDe689W44GE1u5kl/tecqnJodGK89/bz3z0b4xj6xnXTBHP77eihPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781069606; c=relaxed/simple; bh=wJNi8KGroFeYyeGeZaK+E1/RR8s56hkJSjJF4FhVonw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SM9nWgas8imWcwellcaC88bEZLiiWe/W3mAUY8U1X/u7E4+398W9Jj9vbvywJCSgTGmuuCHtym9YA+sCgYuuNMhSq7Qs1QetDUlNXHpAsXDp5ZpfVzIvJEGFm9dkHfYqz93xU9kRbyTpN7+bI3zFL6hHLm4B0VKLhLM6nkAea6o= 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=Bco/TAFP; arc=none smtp.client-ip=209.85.214.182 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="Bco/TAFP" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2bf30d530bdso63779095ad.3 for ; Tue, 09 Jun 2026 22:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781069604; x=1781674404; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sXMoJERtGY7hktVR7ChkwsDsIRvHs1FRpH9Atl/UdCs=; b=Bco/TAFPTCf9ALVUAMYt9fZr693+P6Kpg+0gbW77tT+JIHLLsxtkF5av4aJqaAwjjg x/ZfmNjAJ3xTcjtHmL3Z4gYXZ/xnemtdH0zewIHALB96JlQDkT1AhX+1j64JtcgnAlKR RTPN31ieCodSEA6U2zRkhLqXcRKudVCa9EIW1n1Xe18bmIoLfjp2ly+0PM0Ilm5l+Iio d1JfxF1fQzzqwzyuVX8ecXhxrQ2/ZDAJ0OjJHYAROFUVcns9G/Nf0xHJLsKqqYsNpkNa ixMu80X6UdW6h7DoWncfa2v4XLCeqzl347viN9NOrzHQkzupbEctRQm0zmS43qkDUpIX 7oOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781069604; x=1781674404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sXMoJERtGY7hktVR7ChkwsDsIRvHs1FRpH9Atl/UdCs=; b=elT80gxxlUYdIGLzSI49FJ5WtbaioqHNHniNjMWFybLflt+FhADG3VO1lVVdiO97oP Ho+XicK13MdE9qY2fvrUsgPDWomtg6ebAUx236s3W/gYWy7zJSub8dkt9wivJyWhyj4x LWhJNsgH+1IFOJKrfG2keTKp4PKoYkEM48GwqCt1fIMSwx2SHunvqMqxAjWUN2Vnz/D2 1tTMm3K1Qu92aDi4Cd4s3GZ8Q3RihsR6+brR7QQCGWhffYBgI2uGHcIyuqyjwIXaYEui BoR9Ct56g/3ff56r4YHJJKUEg3tova0fpDlsjVFQ8HVC8Q0Xi3ETwx89D9PHo7t5JKaE n9bg== X-Forwarded-Encrypted: i=1; AFNElJ8F38oDFSoWwo5v+jhusC1uOduJa+cdzRiGH74oKmjCQ7Z7xNlc2Ox/dB2gg9NX+ihYvVxDm0PZ2cIA8P0=@vger.kernel.org X-Gm-Message-State: AOJu0YyGYoV+aOaCirkI71iChyz8IW2S8Pyh92Tpl9/cqSROulZ1BoBo O8rD/VRfxdXq85IGuAVnsEmnSHKqzmODD0yrgAoO8AA5JCzvqm1Vqfrj X-Gm-Gg: Acq92OEX5zqx14egf5y3x62YNSArJcfA4+A9kajds9f/JsjPRQZDABDUFgmKhX7dUSN asYVVMLzqiGTxVjgyPcya1tsOWnB+8HF2VXEmAVYPEXvokvTcAhqrLhCDTy1Uqek8HFRSHxWHKM NAfMkPu7P4O3kgfCiNd0kJgBO34ziprQgBC9Cv6uKU6i47rYbU/wrAPNInbFPAqvrVZ82tspEDl 9r6QOctxe0iIVRvhD0HCs+ShiZXffuTjy31xNW7fHRCyTp0ncLpLihpqFgFk3PPycZfAclg2+kY aW97XyVezHlDlI9SAsCtiztZchPRAMLifmBVch9Rj7Oano3Hz8YaMoHC9t4Z8MJGtooQdQkAgnb 3eSGOy/u36oWxzPJH064lmxvWqZLSkemN5mFIxnOr9xJLGroWwfyMHG9On+stdfb9fvc4wSIxqF aNUtfoN+ucl6wGeXn3vBLCtwls6FDxu2KtvBog5/eGmUWSjzi2K7Qp4r73eyMZm99DNdHf5FSe9 Ab0zji9YCRTfRUEGEqjJRSNAq5GEGEG0AnYI/aaiaMKpCm5QNN9xJMUJOdgF4Uf X-Received: by 2002:a17:903:28e:b0:2c0:bff4:96a7 with SMTP id d9443c01a7336-2c1e7e55653mr247195935ad.12.1781069604384; Tue, 09 Jun 2026 22:33:24 -0700 (PDT) Received: from localhost.localdomain (n49-176-80-106.mas22.nsw.optusnet.com.au. [49.176.80.106]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164f8bc5asm242862735ad.27.2026.06.09.22.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 22:33:23 -0700 (PDT) From: Weigang He To: Daniel Palmer Cc: Romain Perier , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Weigang He Subject: [PATCH 1/2] ARM: mstar: fix device_node refcount leak in mstarv7_boot_secondary() Date: Wed, 10 Jun 2026 15:33:11 +1000 Message-ID: <20260610053312.2267307-2-geoffreyhe2@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260610053312.2267307-1-geoffreyhe2@gmail.com> References: <20260610053312.2267307-1-geoffreyhe2@gmail.com> 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_compatible_node() returns a device_node with its refcount incremented; the caller must drop it with of_node_put() when done. mstarv7_boot_secondary() obtains the "mstar,smpctrl" node, maps it with of_iomap() and never releases the reference, leaking it on both the -ENODEV error path and the success path. mstar SoCs do not support CPU hot-unplug (mstarv7_smp_ops provides no .cpu_die), so this leaks one refcount on the smpctrl node once per boot when the secondary CPU is brought up. Drop the reference right after of_iomap(), since np is not used afterwards. Found by static analysis tool CodeQL. Fixes: 5919eec0f092 ("ARM: mstar: SMP support") Signed-off-by: Weigang He --- arch/arm/mach-mstar/mstarv7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-mstar/mstarv7.c b/arch/arm/mach-mstar/mstarv7.c index 274c4f0df270f..871c0fd258e66 100644 --- a/arch/arm/mach-mstar/mstarv7.c +++ b/arch/arm/mach-mstar/mstarv7.c @@ -86,6 +86,7 @@ static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle) np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl"); smpctrl = of_iomap(np, 0); + of_node_put(np); if (!smpctrl) return -ENODEV; -- 2.43.0