From: Linkui Xiao <xiaolinkui@126.com>
To: netdev-bot+sashiko@kernel.org
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
Subject: Re: [PATCH net-next] net: ethtool: request rtnl_lock for ETHTOOL_MSG_PORT_GET
Date: Mon, 16 Nov 2026 11:09:23 +0800 [thread overview]
Message-ID: <6aaecc63-8d85-4fef-8a1e-65d5f29205b9@126.com> (raw)
In-Reply-To: <179472857971.2199510.5265696099741665969@kernel.org>
- [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
prev parent reply other threads:[~2026-11-16 3:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 7:27 [PATCH net-next] net: ethtool: request rtnl_lock for ETHTOOL_MSG_PORT_GET Linkui Xiao
2026-11-12 17:24 ` Stanislav Fomichev
2026-11-16 2:54 ` Linkui Xiao
2026-11-15 7:42 ` netdev-bot+sashiko
2026-11-16 3:09 ` Linkui Xiao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6aaecc63-8d85-4fef-8a1e-65d5f29205b9@126.com \
--to=xiaolinkui@126.com \
--cc=alexanderduyck@fb.com \
--cc=andrew@lunn.ch \
--cc=bjorn@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=xiaolinkui@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox