From: Eduard Zateev <hackerowskiy@gmail.com>
To: steffen.klassert@secunet.com, herbert@gondor.apana.org.au
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+f3f4fce0609f8e91b540@syzkaller.appspotmail.com,
Eduard Zateev <hackerowskiy@gmail.com>
Subject: [PATCH] xfrm: disable state hash resize work on netns exit
Date: Thu, 22 Oct 2026 12:26:41 +0200 [thread overview]
Message-ID: <20261022102641.1429128-1-hackerowskiy@gmail.com> (raw)
xfrm_state_fini() flushes state_hash_work before it inspects and frees the
per-net state hash tables. A concurrent state insertion can queue another
resize while that flush is in progress. The resize worker may then replace
and free a table while teardown is still walking it.
Disable and drain state_hash_work before flushing states and freeing the
tables. This also prevents a new resize from being queued during teardown.
Fixes: f034b5d4efdf ("[XFRM]: Dynamic xfrm_state hash table sizing.")
Reported-by: syzbot+f3f4fce0609f8e91b540@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f3f4fce0609f8e91b540
Assisted-by: LLM
Build-tested: W=1 ARCH=arm64 net/xfrm/ (out-of-tree build).
No reproducer was available to run the teardown race locally.
Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
---
net/xfrm/xfrm_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index e45aa1ed5b9..8a2e465bd73 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -3392,7 +3392,7 @@ void xfrm_state_fini(struct net *net)
unsigned int sz;
int i;
- flush_work(&net->xfrm.state_hash_work);
+ disable_work_sync(&net->xfrm.state_hash_work);
xfrm_state_flush(net, 0, false);
flush_work(&xfrm_state_gc_work);
--
2.55.0
next reply other threads:[~2026-10-22 10:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 10:26 Eduard Zateev [this message]
2026-10-22 10:48 ` Florian Westphal
2026-10-22 10:48 ` Eric Dumazet
2026-10-22 10:51 ` Florian Westphal
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=20261022102641.1429128-1-hackerowskiy@gmail.com \
--to=hackerowskiy@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.com \
--cc=syzbot+f3f4fce0609f8e91b540@syzkaller.appspotmail.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®