From: Steffen Klassert <steffen.klassert@secunet.com>
To: Tristan Madani <tristmd@gmail.com>
Cc: 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>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH v2 ipsec-next] xfrm: check state validity under lock in xfrm_state_find()
Date: Thu, 19 Nov 2026 09:23:09 +0100 [thread overview]
Message-ID: <av6x7V11EyNhg00f@gauss4> (raw)
In-Reply-To: <20261030145229.74412-1-tristmd@gmail.com>
On Fri, Oct 30, 2026 at 02:52:29PM +0000, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> The output-cache insertion path in xfrm_state_find() checks
> x->km.state == XFRM_STATE_VALID before acquiring xfrm_state_lock,
> then inserts the state into pol->state_cache_list under the lock.
>
> While this insertion block is currently unreachable -- cached is set
> unconditionally at the cached: label, making the !cached guard
> always false -- the correct pattern is to perform the validity
> check under the lock, matching the fix in commit ddd3d01329203
> ("xfrm: Fix xfrm state cache insertion race") which addressed the
> same TOCTOU for the input cache path.
>
> Move the XFRM_STATE_VALID check inside the critical section so the
> pattern is correct when the cache insertion becomes reachable.
>
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Applied, thanks a lot!
prev parent reply other threads:[~2026-11-19 8:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 14:52 Tristan Madani
2026-11-19 8:23 ` 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=av6x7V11EyNhg00f@gauss4 \
--to=steffen.klassert@secunet.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=tristan@talencesecurity.com \
--cc=tristmd@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
all inboxes | Powered by JetHome®