[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <60cfc1af3f85dda740ac19ac06a27880e79c9c1e.camel@nvidia.com>
Date: Thu, 6 Mar 2025 13:37:15 +0000
From: Cosmin Ratiu <cratiu@...dia.com>
To: "liuhangbin@...il.com" <liuhangbin@...il.com>
CC: Petr Machata <petrm@...dia.com>, "shuah@...nel.org" <shuah@...nel.org>,
"andrew+netdev@...n.ch" <andrew+netdev@...n.ch>, "davem@...emloft.net"
<davem@...emloft.net>, Jianbo Liu <jianbol@...dia.com>, "jarod@...hat.com"
<jarod@...hat.com>, "razor@...ckwall.org" <razor@...ckwall.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>, "edumazet@...gle.com"
<edumazet@...gle.com>, "jv@...sburgh.net" <jv@...sburgh.net>,
"horms@...nel.org" <horms@...nel.org>, "kuba@...nel.org" <kuba@...nel.org>,
Tariq Toukan <tariqt@...dia.com>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "steffen.klassert@...unet.com"
<steffen.klassert@...unet.com>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>
Subject: Re: [PATCHv4 net 1/3] bonding: move IPsec deletion to
bond_ipsec_free_sa
On Thu, 2025-03-06 at 10:02 +0000, Hangbin Liu wrote:
> > For bond_ipsec_add_sa_all(), I will move the xso.real_dev =
> > real_dev
> > after .xdo_dev_state_add() in case the following situation.
xso.real_dev needs to be initialized before the call to
xdo_dev_state_add, since many of the implementations look in
xso.real_dev to determine on which device to operate on.
So the ordering should be:
- get the lock
- set xso.real_dev to real_dev
- release the lock
- call xdo_dev_state_add
- if it fails, reacquire the lock and set the device to NULL.
Unfortunately, this doesn't seem to protect against the scenario below,
as after dropping the spinlock from bond_ipsec_add_sa_all,
bond_ipsec_del_sa can freely call xdo_dev_state_delete() on real_dev
before xdo_dev_state_add happens.
I don't know what to do in this case...
> >
> > bond_ipsec_add_sa_all()
> > spin_unlock(&ipsec->x->lock);
> > ipsec->xs->xso.real_dev = real_dev;
> > __xfrm_state_delete x->state = DEAD
> > - bond_ipsec_del_sa()
> > - .xdo_dev_state_delete()
> > .xdo_dev_state_add()
Cosmin.
Powered by blists - more mailing lists