From: Steffen Klassert <steffen.klassert@secunet.com>
To: Minwoo Ra <raminwo0202@gmail.com>
Cc: <netdev@vger.kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Christophe Gouault <christophe.gouault@6wind.com>
Subject: Re: [PATCH net] xfrm: prevent policy_hthresh.work from racing with netns teardown
Date: Tue, 17 Mar 2026 11:41:36 +0100 [thread overview]
Message-ID: <abkv4Hwt2Mx9M0M3@secunet.com> (raw)
In-Reply-To: <20260313155929.7406-1-raminwo0202@gmail.com>
On Sat, Mar 14, 2026 at 12:58:44AM +0900, Minwoo Ra wrote:
> A XFRM_MSG_NEWSPDINFO request can queue the per-net work item
> policy_hthresh.work onto the system workqueue.
>
> The queued callback, xfrm_hash_rebuild(), retrieves the enclosing
> struct net via container_of(). If the net namespace is torn down
> before that work runs, the associated struct net may already have
> been freed, and xfrm_hash_rebuild() may then dereference stale memory.
>
> xfrm_policy_fini() already flushes policy_hash_work during teardown,
> but it does not synchronize policy_hthresh.work.
>
> Synchronize policy_hthresh.work in xfrm_policy_fini() as well, so the
> queued work cannot outlive the net namespace teardown and access a
> freed struct net.
>
> Fixes: 880a6fab8f6b ("xfrm: configure policy hash table thresholds by netlink")
> Signed-off-by: Minwoo Ra <raminwo0202@gmail.com>
Patch applied, thanks a lot!
prev parent reply other threads:[~2026-03-17 10:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 15:58 [PATCH net] xfrm: prevent policy_hthresh.work from racing with netns teardown Minwoo Ra
2026-03-17 10:41 ` 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=abkv4Hwt2Mx9M0M3@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=christophe.gouault@6wind.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raminwo0202@gmail.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