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, 28 Jul 2023 07:53:04 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
	pabeni@...hat.com, sd@...asysnail.net
Subject: Re: [PATCH net-next v2 1/2] net: store netdevs in an xarray

On Thu, Jul 27, 2023 at 08:45:19AM -0700, Jakub Kicinski wrote:
> On Thu, 27 Jul 2023 16:08:24 +0300 Leon Romanovsky wrote:
> > > +	if (!ifindex)
> > > +		err = xa_alloc_cyclic(&net->dev_by_index, &ifindex, NULL,
> > > +				      xa_limit_31b, &net->ifindex, GFP_KERNEL);
> > > +	else
> > > +		err = xa_insert(&net->dev_by_index, ifindex, NULL, GFP_KERNEL);
> > > +	if (err < 0)
> > > +		return err;
> > > +
> > > +	return ifindex;  
> > 
> > ifindex is now u32, but you return it as int. In potential, you can
> > return valid ifindex which will be treated as error.
> > 
> > You should ensure that ifindex doesn't have signed bit on.
> 
> I'm feeding xa_alloc_cyclic() xa_limit_31b, which should take care 
> of that, no?

And what about xa_insert() call? Is it safe?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ