lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 7 Dec 2021 11:05:27 +0200
From:   Julian Wiedmann <jwi@...ux.ibm.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Antoine Tenart <atenart@...nel.org>, davem@...emloft.net,
        alexander.duyck@...il.com, mkubecek@...e.cz, netdev@...r.kernel.org
Subject: Re: [PATCH net] ethtool: do not perform operations on net devices
 being unregistered

On 06.12.21 17:15, Jakub Kicinski wrote:
> On Mon, 6 Dec 2021 11:46:35 +0200 Julian Wiedmann wrote:
>> On 03.12.21 12:13, Antoine Tenart wrote:
>>> There is a short period between a net device starts to be unregistered
>>> and when it is actually gone. In that time frame ethtool operations
>>> could still be performed, which might end up in unwanted or undefined
>>> behaviours[1].
>>>
>>> Do not allow ethtool operations after a net device starts its
>>> unregistration. This patch targets the netlink part as the ioctl one
>>> isn't affected: the reference to the net device is taken and the
>>> operation is executed within an rtnl lock section and the net device
>>> won't be found after unregister.
>>> [...]
>>> +++ b/net/ethtool/netlink.c
>>> @@ -40,7 +40,8 @@ int ethnl_ops_begin(struct net_device *dev)
>>>  	if (dev->dev.parent)
>>>  		pm_runtime_get_sync(dev->dev.parent);
>>>  
>>> -	if (!netif_device_present(dev)) {
>>> +	if (!netif_device_present(dev) ||
>>> +	    dev->reg_state == NETREG_UNREGISTERING) {
>>>  		ret = -ENODEV;
>>>  		goto err;
>>>  	}
>>>   
>>
>> Wondering if other places would also benefit from a netif_device_detach()
>> in the unregistration sequence ...
> 
> Sounds like a good idea but maybe as a follow up to net-next? 
> The likelihood of that breaking things is low, but non-zero.
> 

Oh absolutely, only via net-next.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ