From: Steffen Klassert <steffen.klassert@secunet.com>
To: Shaomin Chen <eeesssooo020@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@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>,
Christian Hopps <chopps@labn.net>, <stable@vger.kernel.org>
Subject: Re: [PATCH net] xfrm: iptfs: reset runtime state when cloning SAs
Date: Tue, 26 May 2026 12:24:04 +0200 [thread overview]
Message-ID: <ahV0xGfaH-eOVgGx@secunet.com> (raw)
In-Reply-To: <20260520180723.965339-1-eeesssooo020@gmail.com>
On Thu, May 21, 2026 at 02:07:23AM +0800, Shaomin Chen wrote:
> iptfs_clone_state() clones the IPTFS mode data with kmemdup(). This
> copies runtime objects which must not be shared with the original SA,
> including the embedded sk_buff_head, hrtimers, spinlock, and in-flight
> reassembly/reorder state.
>
> If xfrm_state_migrate() fails after clone_state() but before the later
> init_state() call has reinitialized those fields, the cloned state can be
> destroyed by xfrm_state_gc_task() with list and timer state copied from the
> original SA. With queued packets this lets the clone splice and free skbs
> owned by the original IPTFS queue, leading to use-after-free and
> double-free reports in iptfs_destroy_state() and skb release paths.
>
> Reinitialize the clone's runtime state before publishing it through
> x->mode_data. Because clone_state() now publishes a destroyable mode_data
> object before init_state(), take the mode callback module reference there.
> Avoid taking it again from __iptfs_init_state() for the same object.
>
> Fixes: 0e4fbf013fa5 ("xfrm: iptfs: add user packet (tunnel ingress) handling")
> Cc: stable@vger.kernel.org
> Signed-off-by: Shaomin Chen <eeesssooo020@gmail.com>
Applied, thanks a lot!
prev parent reply other threads:[~2026-05-26 10:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 18:07 [PATCH net] xfrm: iptfs: reset runtime state when cloning SAs Shaomin Chen
2026-05-26 10:24 ` 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=ahV0xGfaH-eOVgGx@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=chopps@labn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eeesssooo020@gmail.com \
--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=stable@vger.kernel.org \
/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