From: Louis Peens <louis.peens@corigine.com>
To: Jakub Kicinski <kuba@kernel.org>
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: Wed, 10 May 2023 08:10:59 +0200 [thread overview]
Message-ID: <ZFs1c2VLJIJTj0+B@LouisNoVo> (raw)
In-Reply-To: <20230509194013.3c73ffbb@kernel.org>
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
>
prev parent reply other threads:[~2023-05-10 6:11 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
2023-05-10 6:10 ` Louis Peens [this message]
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=ZFs1c2VLJIJTj0+B@LouisNoVo \
--to=louis.peens@corigine.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).