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]
Message-ID: <Ze7YNu5TrzClQcxy@gmail.com>
Date: Mon, 11 Mar 2024 03:08:54 -0700
From: Breno Leitao <leitao@...ian.org>
To: Leon Romanovsky <leon@...nel.org>
Cc: Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
	Jason Gunthorpe <jgg@...pe.ca>, kuba@...nel.org,
	keescook@...omium.org,
	"open list:HFI1 DRIVER" <linux-rdma@...r.kernel.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] IB/hfi1: allocate dummy net_device dynamically

Hello Leon,

On Sun, Mar 10, 2024 at 12:14:51PM +0200, Leon Romanovsky wrote:
> On Fri, Mar 08, 2024 at 10:29:50AM -0800, Breno Leitao wrote:
> > struct net_device shouldn't be embedded into any structure, instead,
> > the owner should use the priv space to embed their state into net_device.
> 
> Why?

>From my experience, you can leverage all the helpers to deal with the
relationship between struct net_device and you private structure. Here
are some examples that comes to my mind:

* alloc_netdev() allocates the private structure for you
* netdev_priv() gets the private structure for you
* dev->priv_destructor sets the destructure to be called when the
  interface goes away or failures.

> > @@ -360,7 +360,11 @@ int hfi1_alloc_rx(struct hfi1_devdata *dd)
> >  	if (!rx)
> >  		return -ENOMEM;
> >  	rx->dd = dd;
> > -	init_dummy_netdev(&rx->rx_napi);
> > +	rx->rx_napi = alloc_netdev(sizeof(struct iwl_trans_pcie *),
> > +				   "dummy", NET_NAME_UNKNOWN,
> 
> Will it create multiple "dummy" netdev in the system? Will all devices
> have the same "dummy" name?

Are these devices visible to userspace?

This allocation are using NET_NAME_UNKNOWN, which implies that the
device is not expose to userspace.

Would you prefer a different name?

> > +				   init_dummy_netdev); +	if
> > (!rx->rx_napi) +		return -ENOMEM;
> 
> You forgot to release previously allocated "rx" here.

Good catch, I will update.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ