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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZFs1c2VLJIJTj0+B@LouisNoVo>
Date: Wed, 10 May 2023 08:10:59 +0200
From: Louis Peens <louis.peens@...igine.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: David Miller <davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <simon.horman@...igine.com>, netdev@...r.kernel.org,
	stable@...r.kernel.org, oss-drivers@...igine.com
Subject: Re: [PATCH net] nfp: fix rcu_read_lock/unlock while rcu_derefrencing

On Tue, May 09, 2023 at 07:40:13PM -0700, Jakub Kicinski wrote:
> On Tue,  9 May 2023 08:06:32 +0200 Louis Peens wrote:
> > +static inline
> > +struct net_device *nfp_app_dev_get_locked(struct nfp_app *app, u32 id,
> 
> _locked() in what way? RCU functions typically use an _rcu suffix, no?
We were discussing the naming during internal review, for some reason didn't
think about using _rcu, will update if there is a v2.
> 
> > +					  bool *redir_egress)
> > +{
> > +	struct net_device *dev;
> > +
> > +	if (unlikely(!app || !app->type->dev_get))
> > +		return NULL;
> > +
> > +	rcu_read_lock();
> > +	dev = app->type->dev_get(app, id, redir_egress);
> > +	rcu_read_unlock();
> > +
> > +	return dev;
> 
> this looks very suspicious, RCU takes care primarily of the lifetime of
> objects, in this case dev. Returning it after dropping the lock seems
> wrong.
> 
> If the context is safe maybe it's a better idea to change the 
> condition in rcu_dereference_check() to include rcu_read_lock_bh_held()?
Thanks, will take a closer look at this.
> -- 
> pw-bot: cr
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ