From: Edward Cree <ecree.xilinx@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, Antoine Tenart <atenart@kernel.org>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
netdev@vger.kernel.org
Subject: Re: [PATCH net] net: avoid race between device unregistration and set_channels
Date: Wed, 15 Jan 2025 02:51:12 +0000 [thread overview]
Message-ID: <f87576e0-93d2-42fe-a6da-09430386bc16@gmail.com> (raw)
In-Reply-To: <20250114112401.545a70f7@kernel.org>
On 14/01/2025 19:24, Jakub Kicinski wrote:
> On Mon, 13 Jan 2025 17:18:40 +0100 Antoine Tenart wrote:
>> This is because unregister_netdevice_many_notify might run before
>> set_channels (both are under rtnl).
>
> But that is very bad, not at all sane. The set call should not proceed
> once dismantle begins.
>
> How about this?
>
> diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index 849c98e637c6..913c8e329a06 100644
> --- a/net/ethtool/netlink.c
> +++ b/net/ethtool/netlink.c
> @@ -90,7 +90,7 @@ int ethnl_ops_begin(struct net_device *dev)
> pm_runtime_get_sync(dev->dev.parent);
>
> if (!netif_device_present(dev) ||
> - dev->reg_state == NETREG_UNREGISTERING) {
> + dev->reg_state > NETREG_REGISTERED) {
> ret = -ENODEV;
> goto err;
> }
>
Would __dev_ethtool() need a similar check?
next prev parent reply other threads:[~2025-01-15 2:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 16:18 [PATCH net] net: avoid race between device unregistration and set_channels Antoine Tenart
2025-01-14 10:09 ` Edward Cree
2025-01-14 10:41 ` Antoine Tenart
2025-01-14 19:24 ` Jakub Kicinski
2025-01-15 2:51 ` Edward Cree [this message]
2025-01-15 9:41 ` Antoine Tenart
2025-01-15 11:04 ` Edward Cree
2025-01-15 11:12 ` Antoine Tenart
2025-01-15 9:39 ` Antoine Tenart
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=f87576e0-93d2-42fe-a6da-09430386bc16@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).