🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15095

Re: [PATCH net-next v2] net: ethernet: mtk-star-emac: fix device_node leak in mtk_star_probe()

#15095
From: Lorenzo Bianconi
Date: Thu, 12 Nov 2026 11:04
43 lines
9677 bytes
--M+g60A+VzcHE/eYH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

> On Thu, Nov 12, 2026 at 11:51:30AM +0800, Xia Yan wrote:
> > mtk_star_probe() gets the PHY node from the "phy-handle" property
> > with of_parse_phandle(). The helper takes a reference on the node it
> > returns. The node is used by of_phy_connect() each time the netdevice
> > is opened.
> >=20
> > That reference is never dropped. Every error return after the lookup
> > leaks it. Unbind leaks it as well: the driver is devm-only and has no
> > remove callback.
> >=20
> > Release it with a devm action, registered right after the lookup.
> > The error paths and the unbind path then drop the node through the
> > devm cleanup.
> >=20
> > Found during a code review of the OF node handling in ethernet drivers.
> >=20
> > Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> > Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
> > ---
>=20
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>=
=20

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

--M+g60A+VzcHE/eYH
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCavWdOQAKCRA6cBh0uS2t
rLnFAP4t87cBlMJ+fUJahaPjJi8B3GWxyaVfmrXmlILfRGb5qQEAsjrfcpkk5YhG
7DqsExQBjxDfj0q+vBkDdWDJRPn3NQ0=
=yqVZ
-----END PGP SIGNATURE-----

--M+g60A+VzcHE/eYH--
Technical Details
Message-ID: <avWdOWzBtEynoi7t@lore-desk>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361749-linux-kernel-netdev=dewy.ru
References: <1794455490000.585551.2561101329908158128@cmss.chinamobile.com> <u6jz3rgrlwhlbhqwgi26lsa2knkwgjws6scbb6e3dq6bkjmudi@hiulukf72wrr>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361749-linux-kernel-netdev=dewy.ru
From: lorenzo@kernel.org (Lorenzo Bianconi)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net: ethernet: mtk-star-emac: fix
 device_node leak in mtk_star_probe()
Date: Thu, 12 Nov 2026 12:04:25 +0100
Organization: Usenet Network
Message-ID: <avWdOWzBtEynoi7t@lore-desk>
References: <1794455490000.585551.2561101329908158128@cmss.chinamobile.com>
 <u6jz3rgrlwhlbhqwgi26lsa2knkwgjws6scbb6e3dq6bkjmudi@hiulukf72wrr>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="M+g60A+VzcHE/eYH"
Injection-Info: usenet.network;
	logging-data="1073943"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:dTwL6okCfzIOnfLAeqtaukcQjuA= sha256:+heGaCwhaP05HcoB/lMStnthk0YSQskJQsc5vroITwY=
	sha1:JyjRtmlGYtxjwYa+T9TwdMFej1I= sha256:BtwWOrEsWI8n8dQrQJIjV7AztvijUy3qAXCaOFr6oTA=
Content-Disposition: inline
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 376981141F7; Thu, 12 Nov 2026 14:30:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=pass (2048-bit key)
	header.d=kernel.org
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 gsFwxi7WvmOS;
	Thu, 12 Nov 2026 14:30:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361749-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 3B9241141F4; Thu, 12 Nov 2026 14:30:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 705F0C2F2E; Thu, 12 Nov 2026 11:04:32 +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=1794481469;
	b=tGEG77JuCSgP0g5NHLMyFTw+8DN7WKl91igDB1row6y2lk8iiQWJUXT46IMynBXeF3tQ
	 K+ZnC9qz5E9ZnzBOL9cAhNAd2HpIv43gUvltyvlYPnTlKKq/47hgFRj5kprZl+6GyqFJz
	 FmhjlqmoMxL4T/kHlUxhOVHNaWJs1KlfeakkLb/Gcq61x3tayVynt8IzYShIx3YtTXTa8
	 417MMdURJsE3A1EtKw0PamypdrXb59f85H5jJgTQyu/2N98u8VpVIgeU8VeLEE3y0iyTN
	 qTF+E+ra33K1Cq1F3oRAdGh7Bb+v7UD7dbMreqcpdmOaVc98rcftFHYy5asU8FddUUw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794481469;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=H4M2KIRE5a8Yduva+gW2HsKpcDmtHsDzLl02OQNHYTY=;
	b=FBArgY7OmBfx2lsOuZyBoqMUfeNpY9ffkWZTS/KOpj9LmuWHcz+49EQnWZezpCwZgNTn
	 jTTTPEYinYsEpaxrm6+h2k1xjL0gdTIhc0aWHfWu2h4bsuyGnyEOz7kLOn+Po1B2JZVrI
	 YHwbtP73lSEO2djHF3ADweH3XMhjoToW6rqGaNTJ8TkY8Uug/7KWH8kHKF9cZ+bfCVOCR
	 L0z7mqutiawSiDB2u+ATfPwGMWnnOy2o9oCGmp7chCXyE65vf8/8WUQd++mgojQOgZZVx
	 DttbqAXfFXSZ27Dj5raryU1tzAR2Bc8ESUiW5wuykxHizzWwcFdq2Cf0ySi8Oo36o4Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U0Y7Bx5i;
	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 E359E606A33A;
	Thu, 12 Nov 2026 11:04:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U0Y7Bx5i
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794481468;
	b=kTsRCThvU94SQibi2+GOIkRm1XqM+HasDOblWn79/qs5rFRfYnAYVJWQKZac0GBHMXlJ
	 klW65McIayS0wDWtUXum4pXMBjzoNbIkrXaCu7L1lXJZxK8YIjfZAhQBFLokucvKCOIov
	 8kWed8owruRjxYYf1jkCoCZNvabGt3rCHUnC6ldp2JKS/z2gXAcN6BFrVOq9EGQoSUaYG
	 iZpKRfgQEmq4ywIEG6jW1QRoU1V5x11yu3Y5z+uHX/sf1Yiic0bVLZBu23DAOReXKggcj
	 yTWMTE/HPqEhSZXoZGgK2eUzbOxnrytPt3huwuyKLjuaQIVzRLC4gG+NNCRiQWe5GwA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794481468;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=H4M2KIRE5a8Yduva+gW2HsKpcDmtHsDzLl02OQNHYTY=;
	b=HcFsTfx5kCedxY5iXS/g9dX06ipXKKHHszZ8ZCe1v6GQBaQyA8c6mUjjrbpV2QFbVgqY
	 MK33wrhDMqiJ4G2PmpYaCMjLtrv05H47SczUB/lRVHQ/VtLqGhgdQMmPQElJFsg17MqKu
	 9f73+W7rrbK16AK9e+9ZQEVme7fQyFcdPzjS91u1ZJRFhDNSdfugYH6o9fU120suHhhYJ
	 SC+YNOBmfqkiebp+C/+SUPybsGQer2yUK99Nt3BZs5HmTSlG0LASlRigSmeMGS4VWrrmD
	 IWt/yxqYEPADypZG2UWC7ozDNcFDysKsjEDuQSadBsx/8v4+qbGcLb56BDrjsk8Ez/w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U0Y7Bx5i;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C8F1606A31C;
	Thu, 12 Nov 2026 11:04:27 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 255D61F00A06;
	Thu, 12 Nov 2026 11:04:26 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794481467;
	bh=H4M2KIRE5a8Yduva+gW2HsKpcDmtHsDzLl02OQNHYTY=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=U0Y7Bx5igfoFnsIhBYRHENpnKYi05KKx6zHBnvw+ACFNWO11KFwbKuabv5br+W48c
	 iqDGJyALqgkjnzD5pUVTxcNuXAOTlv1wxjcnCGH8r9I1rqaJpDRQPksU4g8vGRcAK8
	 jka04pke2L3Cjh4gCWGMwax/QCxs+oCwQndbR/vBK5JC0wwEL1+X2J+zSv0oyxaM/s
	 LW2+duB+GPWIbu2OKFHY7h7jzBZuVTEaXtSYqBuxY3bR5wpkx/kh+WfD2jamyzNnSk
	 4yWvIQCTZ+KfuXYyJweAEU0HQwOc+awml6peyn0yxPpyRmHDM/kT3lR3ZAdKEpWcLh
	 3Awb3TkOIymuQ==
X-Cc: Xia Yan <yanxia@cmss.chinamobile.com>, netdev@vger.kernel.org,
	Felix Fietkau <nbd@nbd.name>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>,
	Yanqing Wang <ot_yanqing.wang@mediatek.com>,
	linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.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
X-In-Reply-To: <u6jz3rgrlwhlbhqwgi26lsa2knkwgjws6scbb6e3dq6bkjmudi@hiulukf72wrr>