Re: [PATCH net] nfp: fix rcu_read_lock/unlock while rcu_derefrencing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux