From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 280403A4526 for ; Wed, 29 Apr 2026 07:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777446537; cv=none; b=hXkxDXxU/gcM5N5lGzd4rvE1kspgOa5sQB/Cn8Hl96UUMN1S6zz7t3b2q2+cXCwcbYp5Mta85Ql93S0zW1ViT1gIdMZYSXSHmF8+GYMs293Kkdar/cftwZes7WfoG3Kh9xNqZq4EkSKZwBzW7uSl7PKf3gOGIsexuk2gnoy74Y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777446537; c=relaxed/simple; bh=pM1ILh983ZoX2vABTsnRkn0VLZZ/LUJuER+k/7XNt+k=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CwFXoKvx0fM/QFlu2LLndwx8P8hROipRAnHi3vTWWjZ/wGjxJKltOSiISpk74kkB/jzUEAtzwZWgq2R7d31kdWJWyHvquyJI51LKGKMvaJ3qdBm0qyIQ7xV4DL7Ux7iYSxcQ92sjxcQVdfBTs9ijATRd/+wC2n1xyUdjU+7+wAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=0NjTfsvz; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="0NjTfsvz" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id A3D0520826; Wed, 29 Apr 2026 09:08:52 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24qmH6NRVkFr; Wed, 29 Apr 2026 09:08:52 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id 12D5C207D8; Wed, 29 Apr 2026 09:08:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 12D5C207D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1777446532; bh=RyCjBHWKqUGEeCzWiBcPsAdR6PCc1X+MszCgij17VHk=; h=Date:From:To:CC:Subject:References:In-Reply-To:From; b=0NjTfsvzMpQ6J4iHLiWovZ2SM1dE2OIc0VhAFhPDotPZBrn/Qgy1pnYYE24YyPN3A wpHCuZL+blGl/V0NbHDGb6sU1t5HlL7p/prWgUNfNyYb922gK0ATc7ak3ngGI8zL8M Ohnbg9bOo0WElxsdVw+XKn7h00NrJ5JLCGQOCPATg6T/Nd52pG3s37HHnot5DjTA8r yZ2xU2g3QWNnw9Oqnqa4rXd0a1W00akWrjV8RkoWEDE2UV/VaYnhmZpk4m7eY/Ub2R 2dU1NR0aUKpda1ECzWNWdiZair9uGBATK6YCVTr2/E/hrHPMaAn3LWkVwLKY79sXrL TCmDxAaNws0HQ== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 29 Apr 2026 09:08:51 +0200 Received: (nullmailer pid 1129277 invoked by uid 1000); Wed, 29 Apr 2026 07:08:51 -0000 Date: Wed, 29 Apr 2026 09:08:51 +0200 From: Steffen Klassert To: Michal Kosiorek CC: Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Abeni , Simon Horman , Greg Kroah-Hartman , Subject: Re: [PATCH] xfrm: protect __xfrm_state_delete against double-unhash of byseq/byspi Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: EXCH-01.secunet.de (10.32.0.171) To EXCH-01.secunet.de (10.32.0.171) On Tue, Apr 28, 2026 at 09:53:45AM +0200, Michal Kosiorek wrote: ... > > Reported-by: Michal Kosiorek > Tested-by: Michal Kosiorek > Signed-off-by: Michal Kosiorek 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!