From: Steffen Klassert <steffen.klassert@secunet.com>
To: Jianbo Liu <jianbol@nvidia.com>
Cc: <netdev@vger.kernel.org>, <ipsec@lists.linux.dev>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Florian Westphal <fw@strlen.de>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH ipsec 0/4] xfrm: Fix device state teardown races
Date: Tue, 1 Dec 2026 07:34:02 +0100 [thread overview]
Message-ID: <aw5qWhJOBLIZvq1F@gauss4> (raw)
In-Reply-To: <20261125013412.1123866-1-jianbol@nvidia.com>
On Wed, Nov 25, 2026 at 03:34:08AM +0200, Jianbo Liu wrote:
> Three fixes for the teardown of xfrm device offload state and one
> revert, for ipsec.
>
> xfrm_dev_state_free() runs for the same state from the state GC, from
> the device flush and from xfrm_state_find(). Commit 89fefad9f971
> ("xfrm: serialize state GC with device state flush") serializes the
> first two with a mutex, but xfrm_state_find() runs under RCU and
> still races with the flush.
>
> Let only one caller free the device state of an SA, hold a state
> reference in the flush and wait for an RCU grace period before the
> free. The mutex is not needed after that, so revert that commit.
>
> 1. xfrm: Give GC list nodes their own storage
> Stop sharing the GC list nodes with the bydst and bysrc hash nodes.
> Patch 2 uses gclist on states that RCU readers may still walk.
>
> 2. xfrm: Serialize device state teardown
> Let only one caller free the device state of an SA.
>
> 3. xfrm: Wait for an RCU grace period before freeing device state
> Let RCU readers of the driver state finish before the free.
>
> 4. Revert "xfrm: serialize state GC with device state flush"
> Remove the mutex that the fixes above make redundant.
>
> Jianbo Liu (4):
> xfrm: Give GC list nodes their own storage
> xfrm: Serialize device state teardown
> xfrm: Wait for an RCU grace period before freeing device state
> Revert "xfrm: serialize state GC with device state flush"
>
> include/net/xfrm.h | 10 +++----
> net/xfrm/xfrm_device.c | 4 +--
> net/xfrm/xfrm_state.c | 61 ++++++++++++++++++++++++++----------------
> 3 files changed, 44 insertions(+), 31 deletions(-)
Series applied, thanks a lot Jianbo!
prev parent reply other threads:[~2026-12-01 6:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 1:34 [PATCH ipsec 0/4] xfrm: Fix device state teardown races Jianbo Liu
2026-11-25 1:34 ` [PATCH ipsec 1/4] xfrm: Give GC list nodes their own storage Jianbo Liu
2026-11-29 2:14 ` netdev-bot+sashiko
2026-11-25 1:34 ` [PATCH ipsec 2/4] xfrm: Serialize device state teardown Jianbo Liu
2026-11-29 2:14 ` netdev-bot+sashiko
2026-11-30 1:34 ` Jianbo Liu
2026-11-25 1:34 ` [PATCH ipsec 3/4] xfrm: Wait for an RCU grace period before freeing device state Jianbo Liu
2026-11-29 2:14 ` netdev-bot+sashiko
2026-11-30 1:55 ` Jianbo Liu
2026-11-25 1:34 ` [PATCH ipsec 4/4] Revert "xfrm: serialize state GC with device state flush" Jianbo Liu
2026-11-29 2:14 ` netdev-bot+sashiko
2026-12-01 6:34 ` Steffen Klassert [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=aw5qWhJOBLIZvq1F@gauss4 \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=ipsec@lists.linux.dev \
--cc=jianbol@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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