[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <173693410183.5893.12485926901643155644@kwain>
Date: Wed, 15 Jan 2025 10:41:41 +0100
From: Antoine Tenart <atenart@...nel.org>
To: Edward Cree <ecree.xilinx@...il.com>, Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com, netdev@...r.kernel.org
Subject: Re: [PATCH net] net: avoid race between device unregistration and set_channels
Quoting Edward Cree (2025-01-15 03:51:12)
> 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?
It doesn't because it calls __dev_get_by_name() and returns -ENODEV in
case dismantle started.
Powered by blists - more mailing lists