🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12088

[PATCH net-next] net: dsa: hellcreek: fix device_node leak in hellcreek_led_setup()

#12088
From: Xia Yan
Date: Fri, 06 Nov 2026 08:48
33 lines
9922 bytes
hellcreek_led_setup() walks the two LED child nodes of the "leds" node
with of_get_next_available_child(). The helper drops the reference on
the child passed to it and takes one on the child it returns. After
the second call the caller holds a reference on the second LED node.

That reference is never dropped. The out: label only releases the
"leds" node itself. Boards with both LED child nodes leak one
device_node reference per probe, on the registration failures as well
as on the success path.

Drop it at the out: label, before the parent node. The early exits,
where the walk stopped before the second child, pass NULL, which
of_node_put() ignores.

Found during a code review of the OF node handling in DSA drivers.

Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
---
  drivers/net/dsa/hirschmann/hellcreek_ptp.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
index cb23bea9c21b..ed27731d4f4e 100644
--- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
+++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
@@ -392,6 +392,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek)
 	ret = 0;
 
 out:
+	of_node_put(led);
 	of_node_put(leds);
 
 	return ret;
Technical Details
Message-ID: <1793954912000.3200.3087525628285919529@cmss.chinamobile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357850-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357850-linux-kernel-netdev=dewy.ru
From: yanxia@cmss.chinamobile.com (Xia Yan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next] net: dsa: hellcreek: fix device_node leak in
 hellcreek_led_setup()
Date: Fri, 06 Nov 2026 16:48:32 +0800
Organization: Usenet Network
Message-ID: <1793954912000.3200.3087525628285919529@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3831314"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:asOxcgg/KbcU/aWyYPnE6NvOKZM= sha256:NNCxaiRhijoivjzlB5j6t3OM77b94JJM6hdIl0NzSYA=
	sha1:SVJh8dFbNWpT9N8zpawt2B/LOVg= sha256:N7vkSGItoc3EiMSTXmeayLhfxsgC0I0IlehkLbhc39Q=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C8CEB1131C2; Fri,  6 Nov 2026 11:53:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.751
X-Spam-Status: No, score=-2.751 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key)
	reason="fail (body has been altered)" header.d=cmss.chinamobile.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id atDRvCO1IvOq;
	Fri,  6 Nov 2026 11:53:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357850-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9FBB31131AE; Fri,  6 Nov 2026 11:52:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id AD5F42BB37; Fri,  6 Nov 2026 08:48:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793954918;
	b=cbWe3O2mFVH0/Oug5LVHNOZBeHve/Om5yxIYqJrpAmxbvFxL7FySENoq+QWlb7e/sqdI
	 KjlD/HgDPE2L20hLSUy3fmNdSq+QdYFK4pMWYvqry+nZgBxvA0NT4l4JEftuKdk/UruG+
	 i6tYiQdL6w6xF/k5/kyYd59WW33fqq+mL0Kdqo1G6ISX4ztuRQ+azIvzyFzK3//VSajRH
	 SxYiU8hancu0YIFshtcnE4SRJOkIUNNtr/JodCEA/td5P0reUScxQ8thY6mPUYryMXyGJ
	 nWv7fiFXu0gSLEBLnr1fyKY33F/HKI1bZ9nKzpBrdSsczALEI67jltYlGGsvaS/58rA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793954918;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo:
	 X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:
	 Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=aLGbaNHkUtTFgo7SYRpl/SmqYN5mxNTgYqz9elwLiSs=;
	b=Kkq7Xypa177WgRAmS2BVdz61aTjA4ptjQFZgkYfFeZMPW6dZTE07OJLFcOiQJ7Sp+fMF
	 qFlgQUEniHaUPgklAAUNHv7X3fr0MGJIv76lEvafU6gZ/ZVwQQhmEviyEyaCiOwEtc3Xv
	 2siPcjgy7Iixt8TsXRQhspV/Hlf6QbSzSt9OnEcXLEzlO+ER1x6TPANC6bYyzMJXO7HE8
	 ACHRgk0U6+SCPje9yb4UcQMEiJnf98ZSB6OsjDAHDv6P/AgrARRg5i2l9tASzpuVbCwol
	 ay667lHBLvpFWLsSuEKNBKAVdl2l3NFWMEHeZ/NjljQr0/vUhimBbUiWtJSBzOx3/Zw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=vI5dTAj8;
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 83576606A32F;
	Fri,  6 Nov 2026 08:48:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=vI5dTAj8
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.139
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793954917;
	b=piipVJossyNFLwQCyVjEbnGmXLaUP5/jvxqPfSUmGzG4hwUC8VRYyH1JinOzt33M9buQ
	 l2JguNTypkx8HD3WY4v58x4bO+pdCUy4STK/FXVfn4Wl0DPW/4nrRrV+0G6tI8e8OtZVy
	 TqwGCldTwvGYLVRsA8CA5ddtT+r7MG0+0O9rPsy0jAb0odMDYW5OmpGgwoaztoqh1Sxf4
	 LsbLZoW2qMZClX82uJcIMU3T7fxZesOTD/ZxTGpeLq+PdDfGmNICT4huysNZ5Twv3NaSP
	 ED3OlHwAMxQwzAdWkYkW/2JWQ3rZH6HlB4A9/AE0jaHkT+bIqgd7BUYu0heTv54d3Zg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793954917;
	h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:
	 X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From:
	 To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=aLGbaNHkUtTFgo7SYRpl/SmqYN5mxNTgYqz9elwLiSs=;
	b=5toBmh+Pa/CAasSzkYkht1l1ylYXZZJpwb8WOxbw7skvIJj4ZZ9/5K4xOjoYQQUUSB8y
	 KfWiFxDRx4PTJQ6QaOAeTOauQIuz7lJZ4WrTJAhkSyQ+iJbpifvOwA15UthqShCXzSKhu
	 k7EAsvOjXu5SPIIINLQ8eSWIFLXvBMbIgjQOLf9hP7mjOSx1WWrRw3Jnwd9lmQjj2D2Gl
	 gZXsskO+iHMGJO7yvBGEOUfI4bClaBPUkVikMtFZvELu0H1jNZLlhbFbY5W2OAo34MUPS
	 K6Ac2h3tWHx1aw+qz/MbW+hix9wsuNvCsyu+NXEtuLBWQMROxkygn2HVrxHELMYve9Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=vI5dTAj8;
	arc=none smtp.remote-ip=111.22.67.139
X-Received: from cmccmta6.chinamobile.com (cmccmta6.chinamobile.com [111.22.67.139])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 55A61606A326;
	Fri,  6 Nov 2026 08:48:34 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55A61606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=cmss.chinamobile.com; s=default; l=0;
	h=from:subject:message-id:to:cc:mime-version;
	bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
	b=vI5dTAj8R82FBpRFNkHeQJa6G84cpzhxW9VxxFmyJ0vsOuKf4DSCt48w0aNvX58aT85HiZum09Ldp
	 wltVWY165X64oVCJ/q1TbmNVkQPCkWucuEJQIF++kZwn2tmChLUk02ZjrTyw2gEE4wVAPRF5+Bv93v
	 sfHPBzr0Nv6a5Amw=
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87])
	by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee16aed946166a-8b881;
	Fri, 06 Nov 2026 16:48:33 +0800 (CST)
X-RM-TRANSID: 2ee16aed946166a-8b881
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from [192.168.229.154] (unknown[223.108.79.97])
	by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee86aed945f73f-19923;
	Fri, 06 Nov 2026 16:48:33 +0800 (CST)
X-RM-TRANSID: 2ee86aed945f73f-19923
X-Cc: Kurt Kanzenbach <kurt@linutronix.de>, Andrew Lunn <andrew@lunn.ch>,
 Vladimir Oltean <olteanv@gmail.com>,
 Richard Cochran <richardcochran@gmail.com>,
 Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
 Paolo Abeni <pabeni@redhat.com>, David S. Miller <davem@davemloft.net>,
 Pavel Zhigulin <Pavel.Zhigulin@kaspersky.com>, linux-kernel@vger.kernel.org,
 yana06070@163.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list