Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4341284pxu; Mon, 12 Oct 2020 16:51:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Mn/eTd3aWCmxYcvOQcD49rZFI3UlvvERKfUqQbkLKV3cnB/fjlEg8FwRstbCLiEA9L4d X-Received: by 2002:a17:906:50e:: with SMTP id j14mr30231993eja.138.1602546686266; Mon, 12 Oct 2020 16:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602546686; cv=none; d=google.com; s=arc-20160816; b=vKJRJ2uf1C3k5aNp083VsxcR83ItEqH3UQTHqCCRlnoA0QoYiqX1j1PB3Uo3xdIxR5 Q/M5CdNMnWp0DkDseJxOqzBuLEWRYb7gg4cyCsizwqDr/eaAYHDlaHHTI47jzDDKQE02 rko65HF2wiUmEKp5MvmKw2+PjI/VLlI40WVJvERAFLyTlKLKc8unDYCmSUFMJ/dLYtYW lT5qi1ESJAWQQTQC6mMRSwvSv3cwWy9QakCINIclmmJlpfUaF90qbWfFQgDk13QZMm9s uXyYI75yvGs3hrb8dkgRdxvMzxG3hzjHuad095sqD5RVDXzI+B5vJKLf4Wr1l4ZQkI3m WgqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uWwYmlbmreXdeoKmJHcWPSsgnmb8FnT2l3YhN2nhFCk=; b=qUn8TAxxPGxiIeZxJERlsf5cweSPQxeD34zfCxC2wlm8btfnAZ6n+bXGXTRdxrqSRB 3lroSB5rEykZNFv4guwtTyME+1rJe34p+IzV653qOC923I6iA2RlcUdvXK+pMdk3D5vT +9cT6xYQApS9fSq5OFNbvkgCx2rN/oUe7hoXFd8YMsTeUFOBuveDSFOTMb9lf0BCIHun lVnzyiy8q3j+Bs4uX2zsOuZ+OPjBvwo22XtD6BVxGaVX+NMPqprTXG0NtnEZKhTSmYGz ku0GN6u9CXv89O/BlvFHzKuQ4bse8+9pEqHRrXhzuldczFSrHwtEzLnpJmjawcaA5Vke 8nzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lPboFW4E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si13840234edq.270.2020.10.12.16.51.03; Mon, 12 Oct 2020 16:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lPboFW4E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731334AbgJLNp0 (ORCPT + 99 others); Mon, 12 Oct 2020 09:45:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:48502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389289AbgJLNnP (ORCPT ); Mon, 12 Oct 2020 09:43:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BFEB721D81; Mon, 12 Oct 2020 13:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510194; bh=NAMGh12AMVvn72LzdUDV6g8w9N4PLdldcf1Bd4jNMB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPboFW4EMMUgae8QkUvqNv+PCGvBxodYXu++vQpmuBU02eWeEEhHH3Uhp3eimbo2Z MKbyNZNnM8vkzcRUIVgr9mX1D53qKYclzypJlOTcqh7C9ftg37D7CI+f7bHnVMHASk 6B9wVs+2wWarxMnKx9ZayISIqMi8NUoxs21Vx8rg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antony Antony , Steffen Klassert , Sasha Levin Subject: [PATCH 5.4 50/85] xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate Date: Mon, 12 Oct 2020 15:27:13 +0200 Message-Id: <20201012132635.272819536@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132632.846779148@linuxfoundation.org> References: <20201012132632.846779148@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antony Antony [ Upstream commit 91a46c6d1b4fcbfa4773df9421b8ad3e58088101 ] XFRMA_REPLAY_ESN_VAL was not cloned completely from the old to the new. Migrate this attribute during XFRMA_MSG_MIGRATE v1->v2: - move curleft cloning to a separate patch Fixes: af2f464e326e ("xfrm: Assign esn pointers when cloning a state") Signed-off-by: Antony Antony Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- include/net/xfrm.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 12aa6e15e43f6..c00b9ae71ae40 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1773,21 +1773,17 @@ static inline unsigned int xfrm_replay_state_esn_len(struct xfrm_replay_state_es static inline int xfrm_replay_clone(struct xfrm_state *x, struct xfrm_state *orig) { - x->replay_esn = kzalloc(xfrm_replay_state_esn_len(orig->replay_esn), + + x->replay_esn = kmemdup(orig->replay_esn, + xfrm_replay_state_esn_len(orig->replay_esn), GFP_KERNEL); if (!x->replay_esn) return -ENOMEM; - - x->replay_esn->bmp_len = orig->replay_esn->bmp_len; - x->replay_esn->replay_window = orig->replay_esn->replay_window; - - x->preplay_esn = kmemdup(x->replay_esn, - xfrm_replay_state_esn_len(x->replay_esn), + x->preplay_esn = kmemdup(orig->preplay_esn, + xfrm_replay_state_esn_len(orig->preplay_esn), GFP_KERNEL); - if (!x->preplay_esn) { - kfree(x->replay_esn); + if (!x->preplay_esn) return -ENOMEM; - } return 0; } -- 2.25.1