[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f87576e0-93d2-42fe-a6da-09430386bc16@gmail.com>
Date: Wed, 15 Jan 2025 02:51:12 +0000
From: Edward Cree <ecree.xilinx@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, Antoine Tenart <atenart@...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
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?
Powered by blists - more mailing lists