From: Cen Zhang <zzzccc427@gmail.com>
To: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, baijiaju1990@gmail.com,
jjzuming@gmail.com, zzzccc427@gmail.com
Subject: [PATCH ipsec 0/2] xfrm: fix state lifetimes in xfrm_migrate()
Date: Sat, 31 Oct 2026 12:14:53 +0800 [thread overview]
Message-ID: <pm-xfrm-core-objects-candidate-0027-v3-cb1e033bff1976f510c9-0@gmail.com> (raw)
xfrm_migrate() keeps the old states in x_cur[] and their successors in
x_new[], but it does not hold a reference to every state it later
deletes. An SA with a hard lifetime can expire and be freed by the timer
and the state GC in that window, and the following xfrm_state_delete()
takes the lock of freed memory:
1/2 The success path drops the lookup references of the old states
before it deletes them. Delete them first.
2/2 xfrm_state_migrate() returns the published successor without a
caller reference, so the rollback deletes states it does not
hold. Take that reference before publishing and drop it after the
migration commits or rolls back.
Both windows date back to the initial migration support and are reached
by XFRM_MSG_MIGRATE and PF_KEY's SADB_X_MIGRATE.
Cen Zhang (2):
xfrm: keep old state references until migration deletion completes
xfrm: hold migrated states through rollback
net/xfrm/xfrm_policy.c | 7 +++++--
net/xfrm/xfrm_state.c | 6 +++++-
2 files changed, 10 insertions(+), 3 deletions(-)
---
next reply other threads:[~2026-10-31 4:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 4:14 Cen Zhang [this message]
2026-10-31 4:14 ` [PATCH ipsec 1/2] xfrm: keep old state references until migration deletion completes Cen Zhang
2026-10-31 4:14 ` [PATCH ipsec 2/2] xfrm: hold migrated states through rollback Cen Zhang
2026-10-31 4:18 ` [PATCH ipsec 0/2] xfrm: fix state lifetimes in xfrm_migrate() netdev-bot+sinfo
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=pm-xfrm-core-objects-candidate-0027-v3-cb1e033bff1976f510c9-0@gmail.com \
--to=zzzccc427@gmail.com \
--cc=baijiaju1990@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=jjzuming@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.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
all inboxes | Powered by JetHome®