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]
Message-ID: <20250305185052.GA354403@ziepe.ca>
Date: Wed, 5 Mar 2025 14:50:52 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: longli@...uxonhyperv.com
Cc: Leon Romanovsky <leon@...nel.org>,
	Konstantin Taranov <kotaranov@...rosoft.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
	Long Li <longli@...rosoft.com>
Subject: Re: [patch rdma-next v3 1/2] net: mana: Change the function
 signature of mana_get_primary_netdev_rcu

On Tue, Mar 04, 2025 at 04:00:01PM -0800, longli@...uxonhyperv.com wrote:
>  
> -struct net_device *mana_get_primary_netdev_rcu(struct mana_context *ac, u32 port_index)
> +struct net_device *mana_get_primary_netdev(struct mana_context *ac, u32 port_index)
>  {
>  	struct net_device *ndev;
>  
> -	RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
> -			 "Taking primary netdev without holding the RCU read lock");
>  	if (port_index >= ac->num_ports)
>  		return NULL;
>  
> +	rcu_read_lock();
> +
>  	/* When mana is used in netvsc, the upper netdevice should be returned. */
>  	if (ac->ports[port_index]->flags & IFF_SLAVE)
>  		ndev = netdev_master_upper_dev_get_rcu(ac->ports[port_index]);
>  	else
>  		ndev = ac->ports[port_index];
>  
> +	dev_hold(ndev);
> +	rcu_read_unlock();

That's much better, yes

Reviewed-by: Jason Gunthorpe <jgg@...dia.com>

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ