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: <20230509194013.3c73ffbb@kernel.org>
Date: Tue, 9 May 2023 19:40:13 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Louis Peens <louis.peens@...igine.com>
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,  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?

> +					  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()?
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ