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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 2 Apr 2021 09:57:52 -0700
From:   Andrei Vagin <avagin@...il.com>
To:     Christian Brauner <christian.brauner@...ntu.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        Alexander Mikhalitsyn <alexander.mikhalitsyn@...tuozzo.com>
Subject: Re: [PATCH net-next] net: Allow to specify ifindex when device is
 moved to another namespace

On Fri, Apr 02, 2021 at 10:20:14AM +0200, Christian Brauner wrote:
> > @@ -11043,6 +11046,11 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
> >  			goto out;
> >  	}
> >  
> > +	/* Check that new_ifindex isn't used yet. */
> > +	err = -EBUSY;
> > +	if (new_ifindex && __dev_get_by_index(net, new_ifindex))
> > +		goto out;
> 
> Should this maybe verify that the new_inindex isn't negative and reject
> it right away? (Maybe also right where we first retrieve it?) Otherwise
> __dev_get_by_index() might pointlessly walk the whole netdev list for
> thet network namespace.
> 

I think __dev_get_by_index works fine for links with negative
ifindices, but there are other places where we expect that ifindex is
positive, so I think you are right, we need to check that it isn't
negative here and we need to add the same check in register_netdevice
too.

Thanks,
Andrei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ