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: Tue, 18 Jun 2024 16:43:07 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: edward.cree@....com, linux-net-drivers@....com, davem@...emloft.com,
 edumazet@...gle.com, pabeni@...hat.com, Edward Cree
 <ecree.xilinx@...il.com>, netdev@...r.kernel.org, habetsm.xilinx@...il.com,
 sudheer.mogilappagari@...el.com, jdamato@...tly.com, mw@...ihalf.com,
 linux@...linux.org.uk, sgoutham@...vell.com, gakula@...vell.com,
 sbhatta@...vell.com, hkelam@...vell.com, saeedm@...dia.com,
 leon@...nel.org, jacob.e.keller@...el.com, andrew@...n.ch,
 ahmed.zaki@...el.com
Subject: Re: [PATCH v5 net-next 1/7] net: move ethtool-related netdev state
 into its own struct

On Tue, 18 Jun 2024 16:05:13 -0700 David Wei wrote:
> > @@ -11065,6 +11065,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
> >  	dev->real_num_rx_queues = rxqs;
> >  	if (netif_alloc_rx_queues(dev))
> >  		goto free_all;
> > +	dev->ethtool = kzalloc(sizeof(*dev->ethtool), GFP_KERNEL_ACCOUNT);  
> 
> Why GFP_KERNEL_ACCOUNT instead of just GFP_KERNEL?

netdevs can be created by a user, think veth getting created in 
a container. So we need to account the allocated memory towards 
the memory limit of the current user.

> > +	if (!dev->ethtool)
> > +		goto free_all;
> >  
> >  	strcpy(dev->name, name);
> >  	dev->name_assign_type = name_assign_type;
> > @@ -11115,6 +11118,7 @@ void free_netdev(struct net_device *dev)
> >  		return;
> >  	}
> >  
> > +	kfree(dev->ethtool);  
> 
> dev->ethtool = NULL?

defensive programming is sometimes permitted by not encouraged :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ