Received: by 10.192.165.156 with SMTP id m28csp1173735imm; Wed, 11 Apr 2018 13:54:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx48zKFBNnId71+EUTytT32IHxPT76+4nJPfVcMwJZha/X06k380/zSRM06yrB4gNr8cxfMlY X-Received: by 10.98.137.218 with SMTP id n87mr5357065pfk.48.1523480045070; Wed, 11 Apr 2018 13:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523480045; cv=none; d=google.com; s=arc-20160816; b=A1IM5FSvXHW0ac3RI+62GOzSkfrgbQbK9vpTa/xnRArFkneFnE/pvZSBWb9oPYS3XO rZNWUSukrWD/G5ixPrNRRPgCUu8MLMAgQoxqATboe8luJtCAt6v277NeZPCTELINSAFC Q7vd6I3MGV6oWNHXcqNTJ71w+cb9lb3b1dNt01JVO/2PjJGBjQZ7nttmelDShgU6Vjnt OZeBnWdRW+jQBfx5O5doz0GSvu9NtQOQ33eRpQcKwAFXXfHpQIGFA5bYvvnZE5GqTI+W RKz+SuKeZBKdiZv8yO5HFsTgJ05pPq7MgJFswPJHvkNz9wd6Z2rWplGdguquNk5cT3M/ 8hgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=unVioLxNi5PgbiGC6af2HPjXM8bk7HZxltYtS/D0JvI=; b=UlbEykXz0Do8q+/ugw71wqItcHSzdZTY/hyzpdYfsAAWAGfwN1BMXeRgBOqYR4QMwf eUaeOV2P/RB8yactFGMcnYGzzCkHXkPpLYr8Ya7FQrwbIlgRaXDrzvFbjDNw6RiffSDy 0zvv6CijzqDFTpStY9qQMnOTHfjd09q8bqE9n/fX4tJ2dcoHKJ39SBoRzpAtag/2cfna XbABQkYeB+rDAuMxQ07qEBdMbku4gLL7uvGgH8EUXbJjwp4kYOgRoQetpXlG5n9n0/F+ tynsB0wImQt3RJmBKsJZfd3cO83JbsrAsqH9C+/wNB7Qnv8ZovKH6N3Vbw7wwKS3PO38 +7CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i133si1203239pgc.299.2018.04.11.13.53.28; Wed, 11 Apr 2018 13:54:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932461AbeDKUu2 (ORCPT + 99 others); Wed, 11 Apr 2018 16:50:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58718 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755608AbeDKSpu (ORCPT ); Wed, 11 Apr 2018 14:45:50 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 076AFCA5; Wed, 11 Apr 2018 18:45:49 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Richard Guy Briggs , Steffen Klassert , Sasha Levin Subject: [PATCH 4.4 054/190] xfrm: fix state migration copy replay sequence numbers Date: Wed, 11 Apr 2018 20:35:00 +0200 Message-Id: <20180411183553.484169269@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Antony Antony [ Upstream commit a486cd23661c9387fb076c3f6ae8b2aa9d20d54a ] During xfrm migration copy replay and preplay sequence numbers from the previous state. Here is a tcpdump output showing the problem. 10.0.10.46 is running vanilla kernel, is the IKE/IPsec responder. After the migration it sent wrong sequence number, reset to 1. The migration is from 10.0.0.52 to 10.0.0.53. IP 10.0.0.52.4500 > 10.0.10.46.4500: UDP-encap: ESP(spi=0x43ef462d,seq=0x7cf), length 136 IP 10.0.10.46.4500 > 10.0.0.52.4500: UDP-encap: ESP(spi=0xca1c282d,seq=0x7cf), length 136 IP 10.0.0.52.4500 > 10.0.10.46.4500: UDP-encap: ESP(spi=0x43ef462d,seq=0x7d0), length 136 IP 10.0.10.46.4500 > 10.0.0.52.4500: UDP-encap: ESP(spi=0xca1c282d,seq=0x7d0), length 136 IP 10.0.0.53.4500 > 10.0.10.46.4500: NONESP-encap: isakmp: child_sa inf2[I] IP 10.0.10.46.4500 > 10.0.0.53.4500: NONESP-encap: isakmp: child_sa inf2[R] IP 10.0.0.53.4500 > 10.0.10.46.4500: NONESP-encap: isakmp: child_sa inf2[I] IP 10.0.10.46.4500 > 10.0.0.53.4500: NONESP-encap: isakmp: child_sa inf2[R] IP 10.0.0.53.4500 > 10.0.10.46.4500: UDP-encap: ESP(spi=0x43ef462d,seq=0x7d1), length 136 NOTE: next sequence is wrong 0x1 IP 10.0.10.46.4500 > 10.0.0.53.4500: UDP-encap: ESP(spi=0xca1c282d,seq=0x1), length 136 IP 10.0.0.53.4500 > 10.0.10.46.4500: UDP-encap: ESP(spi=0x43ef462d,seq=0x7d2), length 136 IP 10.0.10.46.4500 > 10.0.0.53.4500: UDP-encap: ESP(spi=0xca1c282d,seq=0x2), length 136 Signed-off-by: Antony Antony Reviewed-by: Richard Guy Briggs Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_state.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1208,6 +1208,8 @@ static struct xfrm_state *xfrm_state_clo x->curlft.add_time = orig->curlft.add_time; x->km.state = orig->km.state; x->km.seq = orig->km.seq; + x->replay = orig->replay; + x->preplay = orig->preplay; return x;