public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Michal Kosiorek <mkosiorek121@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] xfrm: protect __xfrm_state_delete against double-unhash of byseq/byspi
Date: Wed, 29 Apr 2026 09:08:51 +0200	[thread overview]
Message-ID: <afGug2nzdfjEGHxO@secunet.com> (raw)
In-Reply-To: <CAFRy_Hg8O9smcwzWTdBn6j6NLwv+8vBXKtm2KTsOoG1CjxC2Dg@mail.gmail.com>

On Tue, Apr 28, 2026 at 09:53:45AM +0200, Michal Kosiorek wrote:
...
> 
> Reported-by: Michal Kosiorek <mkosiorek121@gmail.com>
> Tested-by: Michal Kosiorek <mkosiorek121@gmail.com>
> Signed-off-by: Michal Kosiorek <mkosiorek121@gmail.com>

Please add a 'Fixes:' tag so the patch can be backported
to the stable trees.

> ---
>  net/xfrm/xfrm_state.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -758,16 +758,16 @@ int __xfrm_state_delete(struct xfrm_state *x)
> 
>   spin_lock(&net->xfrm.xfrm_state_lock);
>   list_del(&x->km.all);
> - hlist_del_rcu(&x->bydst);
> - hlist_del_rcu(&x->bysrc);
> - if (x->km.seq)
> - hlist_del_rcu(&x->byseq);
> + hlist_del_init_rcu(&x->bydst);
> + hlist_del_init_rcu(&x->bysrc);
> + if (!hlist_unhashed(&x->byseq))
> + hlist_del_init_rcu(&x->byseq);
>   if (!hlist_unhashed(&x->state_cache))
>   hlist_del_rcu(&x->state_cache);
>   if (!hlist_unhashed(&x->state_cache_input))
>   hlist_del_rcu(&x->state_cache_input);
> 
> - if (x->id.spi)
> - hlist_del_rcu(&x->byspi);
> + if (!hlist_unhashed(&x->byspi))
> + hlist_del_init_rcu(&x->byspi);
>   net->xfrm.state_num--;
>   xfrm_nat_keepalive_state_updated(x);
>   spin_unlock(&net->xfrm.xfrm_state_lock);

This does not allpy to the ipsec tree. Please
rebase on the ipsec tree and resend.

Thanks!

       reply	other threads:[~2026-04-29  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFRy_Hg8O9smcwzWTdBn6j6NLwv+8vBXKtm2KTsOoG1CjxC2Dg@mail.gmail.com>
2026-04-29  7:08 ` Steffen Klassert [this message]
2026-04-29  7:21   ` [PATCH] xfrm: protect __xfrm_state_delete against double-unhash of byseq/byspi Greg Kroah-Hartman
2026-04-29  8:29   ` Michal Kosiorek
2026-04-29  8:42     ` Steffen Klassert
2026-04-29  8:54       ` [PATCH ipsec v2] xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete Michal Kosiorek
2026-04-30  7:57         ` Steffen Klassert

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=afGug2nzdfjEGHxO@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkosiorek121@gmail.com \
    --cc=pabeni@redhat.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