🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16917

Re: [PATCH net-next] net: ethtool: request rtnl_lock for ETHTOOL_MSG_PORT_GET

#16917
From: Linkui Xiao
Date: Mon, 16 Nov 2026 03:09
41 lines
10458 bytes
- [High] The fix covers only one of several commands with the same bug.

Thanks for the review.  The patch has been withdrawn following Stanislav's
review (patchwork already shows it rejected), so there is no respin and no
"pw-bot: cr" to send.  On the substance, the observation about the call
sites is accurate - STRSET, LINKSTATE, STATS, PHY, PLCA, PSE, MSE and the
cable test handlers all resolve their PHY through ethnl_req_get_phydev() -
but the conclusion does not follow, because the device this issue asks us
to consider - ops-locked, with a non-NULL dev->link_topo - cannot exist.

dev->link_topo is only ever allocated by phy_link_topo_get_or_alloc(),
whose only callers are phy_link_topo_add_port() and
phy_link_topo_add_phy().  Both refuse an ops-locked device before they
allocate anything:

	if (WARN_ON_ONCE(dev->netdev_ops && netdev_need_ops_lock(dev)))
		return -EOPNOTSUPP;	/* add_port() */

	if (WARN_ON_ONCE(netdev_need_ops_lock(dev)))
		return -EOPNOTSUPP;	/* add_phy() */

So on an ops-locked device dev->link_topo is always NULL, and every
topology reader bails out before its assert:

   - phy_link_topo_get_port() returns at its !topo check, before
     ASSERT_RTNL();
   - phy_link_topo_empty() is simply "return !dev->link_topo", so
     ethnl_req_get_phydev() skips its assert and never touches topo->phys;
   - the cable test handlers resolve their PHY through
     ethnl_req_get_phydev() too, so they hit the same skip.

The drivers that opt into the instance lock (request_ops_lock,
queue_mgmt_ops, net_shaper_ops) all do so before registration, so there
is no path that grows a topology first and becomes ops-locked later
either.  If an ops-locked device ever grows phy_ports, the right fix is
to move the topology readers under the instance lock, as the comments at
the producers already anticipate - not to add a rtnl case per command.

Regards,
Linkui
Technical Details
Message-ID: <6aaecc63-8d85-4fef-8a1e-65d5f29205b9@126.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364022-linux-kernel-netdev=dewy.ru
References: <20261111072724.3295527-1-xiaolinkui@126.com> <179472857971.2199510.5265696099741665969@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364022-linux-kernel-netdev=dewy.ru
From: xiaolinkui@126.com (Linkui Xiao)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: ethtool: request rtnl_lock for
 ETHTOOL_MSG_PORT_GET
Date: Mon, 16 Nov 2026 11:09:23 +0800
Organization: Usenet Network
Message-ID: <6aaecc63-8d85-4fef-8a1e-65d5f29205b9@126.com>
References: <20261111072724.3295527-1-xiaolinkui@126.com>
 <179472857971.2199510.5265696099741665969@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1965490"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8SwaC89Gg1SngVBiLD28ForBb/I= sha256:vcoOnuNHWQoBba9GV3OaHjl4NNUxX+G1bMFQJgynXXI=
	sha1:Rc48IoowfKmcRfiUcNrfvpti5O4= sha256:Y2GQ7MCCVnjaJ/QOOn5wd7+rmUAx7qNd9418PDR8wRI=
Content-Language: en-US
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 B1884114B04; Mon, 16 Nov 2026 06:11:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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=pass (1024-bit key)
	header.d=126.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 uPVKVdxsoaUU;
	Mon, 16 Nov 2026 06:11:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364022-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=126.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8C8BB113927; Mon, 16 Nov 2026 06:10:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id E19BB2EA1C; Mon, 16 Nov 2026 03:10:51 +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=1794798649;
	b=cKHpLbombWrPI/6On3fCbA7N8vg2HAO/9JysXkqnRxxBPWTynklSW2szYaAmaTD0IDwQ
	 19kWT51DCZafpY1Cx40ACNBk5z4zHKF5cplcqsi404vfA8z7NvE8xS6arXtUe3u246iEf
	 vpZShq6gMYZCnmCp3fPvlUTMSnRC1i3e81XfYdEHHvXbNtIb6lvqTpfrb214s2jeOCQwf
	 8QRNkTVHYLcZ3Uv/LAYk8hZTvLtg/ofGum7xBd+ey43F+DjHuewXcflJWTBWlwe+OnZtv
	 Etd3MP6wUbPDJQ9yj+K45TotWAOdPNWslcr80889P4SMyx2u7hWEnwU6Sc218jG+i1Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794798649;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=90ahyTqYBvlXIySaOxks0/UBauBPZtUXCET2ljcJ8X8=;
	b=PpKqILNihc1/qLNw00Z7RL3zc4yTtAIMO4zI0zCJgRsA6LXjYY1daG8YRL+A91mie3+9
	 t92cj0NNM32HShPJK53UAP6lkxv0LZQ2B9TipFhXP4NsD5eVgtsxl2BnUXBGxFVG2dPNv
	 NJn09RsbLL3nysgkAdecYqKsOe2vnxpTxXlZZvDwb3WOwWlztm/WdDR3P7vGzD/I94vjc
	 HS5+WoY/2TAIIxjAIuj0m1SMFERtynymQnTDIzl/toh5M6pNgqLGG7ks/YLsvSuId5teZ
	 hjxYU4tb7Ov67Aar/cLJbYaUNF8s4EbQm7NlzMxR6Yc4qK/KslSi5JYPmNj6xOsIxrQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ipisBCaD;
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.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 4272F606A89B;
	Mon, 16 Nov 2026 03:10:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ipisBCaD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.9
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794798643;
	b=LG3sULXc8c0P96XsM2h2Gk7WsODS7vf8mSd/9a9AUX4430ZHodH13e+OEpPUuLyd92JB
	 QhpTKMCOStWshso4Ks/SYYc03jOHjJG5ZQwdN7zbgzkV4MBFwrpmxzIl4CuYm6uOnUcS0
	 eN/OA80xb+of5Ah4fdiMDkSgCbyKAnGbg7QVva5uVnGJ3qz52GGukhavwmLiOpIfuvp6h
	 ymvQaht+5Os2SifSoZ1xwCDHCFkWG4OPkJ04MApXF7wT+MPpnU6Cz2w0KJK4RQyXYE5b0
	 ACAlGcBGjEqRA5b2tUU8C93k1oVFtuwD6WqEwYYsCgrrImlwjLPuCYFsakFPY3TeVjQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794798643;
	h=DMARC-Filter:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=90ahyTqYBvlXIySaOxks0/UBauBPZtUXCET2ljcJ8X8=;
	b=o8ddn7MUAZenpHGq1FFU2w8zLDr0V/1akxS8L8PEqB9426rPrUcA8vGOXsr9ujA3Aeu/
	 0lCYSfUa6C+eKkY0+dB3c1vplkDQmxHvqMk/ZCLetOTPLdleFIPVHisr0MygG/iqSiqKw
	 8tr8pkDKDRQXlfRoaLLvA4rVzQH3a3alS0r1GTvxcqGoi8wtTva/INa3hZL0rJ4ZOGD/f
	 VIBf2JVi4L1tUwfkegQnqeYbiqp5pn0wp/oACSK0gu0gBPIXrH8DYHFyZ9LDmXWzjYBhZ
	 oUSG5uNcudb9L3mi4AwfAluEGF9/GRyFDHeCpcGZnGit+JPjFtiteS9CXbzVzMUAp6Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ipisBCaD;
	arc=none smtp.remote-ip=220.197.31.9
X-Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.9])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07DB1606A31C;
	Mon, 16 Nov 2026 03:10:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 07DB1606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com;
	s=s110527; h=Message-ID:Date:MIME-Version:Subject:To:From:
	Content-Type; bh=90ahyTqYBvlXIySaOxks0/UBauBPZtUXCET2ljcJ8X8=;
	b=ipisBCaDrPsxLOFyBWnjT9jYmHFX3Tx3YyAzk1tYejGcHM3I6z93iOnMwdO9jE
	k6VgCxPc74Rzb1Yc7n6Al192mF5seC2OiIop6ETOBC3Ecw1pHxK2tdhiXZsof+zS
	5q7lEJvqssj8OkgTfI0y9MAx8dVko9LGAOxkVA11caMj8=
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-User-Agent: Mozilla Thunderbird
X-Cc: andrew@lunn.ch, kuba@kernel.org, davem@davemloft.net,
 edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org, sdf@fomichev.me,
 jacob.e.keller@intel.com, bjorn@kernel.org, alexanderduyck@fb.com,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xiaolinkui@kylinos.cn
X-In-Reply-To: <179472857971.2199510.5265696099741665969@kernel.org>
X-CM-TRANSID: PSkvCgDnL_rjc_pqGXvHCw--.34471S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7ZrykKw17tF4UtFWfWFyrXrb_yoW8Cw18p3
	yqk3WfAF4kGws7XFnrWw1UuFW8ZanrCrZ8tFZrKr13uw45Wr18KFyxtrW0q3W5ur97XF4F
	qFW8JFs7Ar47ZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UxDGOUUUUU=
X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/xtbBqQRvRmr6c+R5DQAA33