From: Hangbin Liu <liuhangbin@gmail.com>
To: Jianbo Liu <jianbol@nvidia.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
Tariq Toukan <tariqt@nvidia.com>,
"andy@greyhouse.net" <andy@greyhouse.net>,
Gal Pressman <gal@nvidia.com>,
"jv@jvosburgh.net" <jv@jvosburgh.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>
Subject: Re: [PATCH net V3 1/3] bonding: implement xdo_dev_state_free and call it after deletion
Date: Thu, 15 Aug 2024 11:34:24 +0800 [thread overview]
Message-ID: <Zr13QBes8L4i1Kvn@Laptop-X1> (raw)
In-Reply-To: <e7ee528b3db5ba94937ca6c933f9060e32f79f3d.camel@nvidia.com>
On Thu, Aug 15, 2024 at 01:23:05AM +0000, Jianbo Liu wrote:
> On Wed, 2024-08-14 at 11:11 +0800, Hangbin Liu wrote:
> > On Wed, Aug 14, 2024 at 02:03:58AM +0000, Jianbo Liu wrote:
> > > On Tue, 2024-08-13 at 07:14 -0700, Jakub Kicinski wrote:
> > > > On Tue, 13 Aug 2024 02:58:12 +0000 Jianbo Liu wrote:
> > > > > > > + rcu_read_lock();
> > > > > > > + bond = netdev_priv(bond_dev);
> > > > > > > + slave = rcu_dereference(bond->curr_active_slave);
> > > > > > > + real_dev = slave ? slave->dev : NULL;
> > > > > > > + rcu_read_unlock();
> > > > > >
> > > > > > What's holding onto real_dev once you drop the rcu lock
> > > > > > here?
> > > > >
> > > > > I think it should be xfrm state (and bond device).
> > > >
> > > > Please explain it in the commit message in more certain terms.
> > >
> > > Sorry, I don't understand. The real_dev is saved in xs-
> > > >xso.real_dev,
> > > and also bond's slave. It's straightforward. What else do I need to
> > > explain?
> >
> > I think Jakub means you need to make sure the real_dev is not freed
> > during
> > xfrmdev_ops. See bond_ipsec_add_sa(). You unlock it too early and
> > later
> > xfrmdev_ops is not protected.
>
> This RCU lock is to protect the reading of curr_active_slave, which is
> pointing to a big stuct - slave struct, so there is no error to get
> real_dev from slave->dev.
It's not about getting real_dev from slave->dev. As Jakub said, What's holding
on real_dev once you drop the rcu lock?
Thanks
Hangbin
next prev parent reply other threads:[~2024-08-15 3:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 5:03 [PATCH net V3 0/3] Fixes for IPsec over bonding Tariq Toukan
2024-08-05 5:03 ` [PATCH net V3 1/3] bonding: implement xdo_dev_state_free and call it after deletion Tariq Toukan
2024-08-06 8:45 ` Hangbin Liu
2024-08-06 9:09 ` Jianbo Liu
2024-08-07 10:11 ` Hangbin Liu
2024-08-13 0:48 ` Jakub Kicinski
2024-08-13 2:58 ` Jianbo Liu
2024-08-13 14:14 ` Jakub Kicinski
2024-08-14 2:03 ` Jianbo Liu
2024-08-14 3:11 ` Hangbin Liu
2024-08-15 1:23 ` Jianbo Liu
2024-08-15 3:34 ` Hangbin Liu [this message]
2024-08-15 3:57 ` Jianbo Liu
2024-08-05 5:03 ` [PATCH net V3 2/3] bonding: extract the use of real_device into local variable Tariq Toukan
2024-08-07 10:13 ` Hangbin Liu
2024-08-05 5:03 ` [PATCH net V3 3/3] bonding: change ipsec_lock from spin lock to mutex Tariq Toukan
2024-08-08 9:34 ` Hangbin Liu
2024-08-08 10:05 ` Jianbo Liu
2024-08-09 2:31 ` Hangbin Liu
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=Zr13QBes8L4i1Kvn@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jianbol@nvidia.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/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