From: Jakub Kicinski <kuba@kernel.org>
To: Louis Peens <louis.peens@corigine.com>
Cc: David Miller <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <simon.horman@corigine.com>,
netdev@vger.kernel.org, stable@vger.kernel.org,
oss-drivers@corigine.com
Subject: Re: [PATCH net] nfp: fix rcu_read_lock/unlock while rcu_derefrencing
Date: Tue, 9 May 2023 19:40:13 -0700 [thread overview]
Message-ID: <20230509194013.3c73ffbb@kernel.org> (raw)
In-Reply-To: <20230509060632.8233-1-louis.peens@corigine.com>
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
next prev parent reply other threads:[~2023-05-10 2:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 6:06 [PATCH net] nfp: fix rcu_read_lock/unlock while rcu_derefrencing Louis Peens
2023-05-09 8:08 ` Leon Romanovsky
2023-05-10 2:40 ` Jakub Kicinski [this message]
2023-05-10 6:10 ` Louis Peens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230509194013.3c73ffbb@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=louis.peens@corigine.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@corigine.com \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox