Received: by 10.192.165.156 with SMTP id m28csp1223296imm; Wed, 11 Apr 2018 14:58:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx49we+3csK9kzaNO0BMq+CoNid/dS+eli3w7O+eqQmd+kfe5Vxuy8s8F8BHYZ/XUFypK5YvN X-Received: by 10.101.68.205 with SMTP id g13mr4560170pgs.387.1523483924200; Wed, 11 Apr 2018 14:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523483924; cv=none; d=google.com; s=arc-20160816; b=GyahJ+8L0Dl/tJ/ffjixaQWd6mVthTzeYgWLQkCbN0QtVi5sCepgeygQrFRE5M8sws yX4Ksyx4CY6ADWr93To2ZP1GvuiFqgNSxLTTgI4z3QkCLuSKSbDIa5BMQwgAlPTGdYwq DAE16Z6GOScTg+TFQ9hfbY6sJ/uzKsf92wM3dCHl71YZPTZAA29K0vE1sdAfMwq5Nu3G qWSSmEZmHSok5f9UeLPmP3xi+6w6Xxcb9DvHdbnFs8rZowlBWiisvTdyo8hyI3qwd0KN 6Gb0hvT0tNhKsXFdojyRmHJnuCudCyiBcGc1KP7FEfmjDiMTrpJEzbIDCVv6ZNq0F479 Xqog== 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=yNnH3MqS3OQr2GnM8qgiIWZ34QWUaFn9gm/p9Uqmbkk=; b=r2xP3DuiHxzr9nylMxLonFySIRDL3KP+jZ71SZ9YIlAeBvwTrKccUAUg4aSfmblQjp AKkHx7+f1qzooEaiasa/3NDn2ZyL9wTF+eb8CRqbQpTOnbP+adIfH7h7sjQtdi9MuBOM OMb7NqExL42ywWRtXrmaxGvwJVZL8MsXK/lFMcklzNn1GbU43FvAgwK/LZHhxvcEzOxR Kjbf0wsmP1kpfRUdCVvBsVolBnEE7/cof/Jpr4XAXmO7yezyS5TISEOejOmBkDkaBXJ7 bf6wqZigF4+6q7TpBMxfgrkNlUI3Ha4LeGoHvjwV1K7lOALGa+hra5P1YOLxZ/rEE2fa QKqA== 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 a64-v6si2035951pla.117.2018.04.11.14.58.07; Wed, 11 Apr 2018 14:58:44 -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 S1756857AbeDKUDO (ORCPT + 99 others); Wed, 11 Apr 2018 16:03:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35664 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933829AbeDKS4F (ORCPT ); Wed, 11 Apr 2018 14:56:05 -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 ABF29CF7; Wed, 11 Apr 2018 18:56:04 +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.9 081/310] xfrm: fix state migration copy replay sequence numbers Date: Wed, 11 Apr 2018 20:33:40 +0200 Message-Id: <20180411183625.776690297@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-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 @@ -1246,6 +1246,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;