Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4360812pxu; Mon, 12 Oct 2020 17:33:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKANpUPDxbEItEicSuz+qOsntT9aMDqbasqI7huvnEalKhIxZy/7X3eLmpAuLeXjhIzOYx X-Received: by 2002:a50:d787:: with SMTP id w7mr17041854edi.296.1602549221374; Mon, 12 Oct 2020 17:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602549221; cv=none; d=google.com; s=arc-20160816; b=yoJNSfT3e2UP9iXRd9OPSIkNFh4DfqtH3W5XQX6AZMK2IFiLZJebgE9ylRG7XL6LVX cNvR59psSCQRXA+FNo8xwJ5meIce5USBwNxxl2e/6jRJKmjDkOxUaVtCe9F7yOseZAn9 3qZOq+l5/PMAdbOCSy6C6eA9eJhAEgJl3mSBuLdF9yniU5qwDXd8FFrP0XGzyeW5ui3+ 7POxrtzdhX//xvify6L2frVG19Opu7bmG4IoeJB1S+W/ZNsiFzXE69WaKSe80yTG/Mma EExTZSpEnEBZE11VKCofpxA5dv7TMqzcR+wGc8XX0nD1oHeiCvOTSznhjo1OmepKk6qn XbKw== 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=m4guHHFg/JvNlISmY76BdAxyYRPFbgpEXCjR3diHYdU=; b=wvcjI3OPCikKH+bOmDXdY6D7HRZ++wN4wh8QeMb+WqHsoqmy/v/+hPrNVVs5gHcW4K TDzkkA8xIKoJJNF3V4yN6Nv8vrOunsdDAel19WeKAAIwEOA0HSYsd19PwsMYMwfVhl5e h297fpMFRX3SU87t8beZOmD2B6BD7uLRKsnn3B/HT1eOhUbfCC6+xC1GJhN4mnZ6GR5m j+cdRzMDtddnaJ416zYJxJq0LPgdgnxYxY1lV35F4RX6LvKSMe0XHWImFMUhIVvW4nKq J2LA0f1z7PA598UFHxMokl4ITtumGN3npJukAaCdA4Yl6IIXjlcrd4fvUjL1kRWgBzyR S4XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TxA4eRjV; 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 h17si12554013ejf.88.2020.10.12.17.33.17; Mon, 12 Oct 2020 17:33:41 -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=TxA4eRjV; 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 S2389927AbgJLNw4 (ORCPT + 99 others); Mon, 12 Oct 2020 09:52:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:55260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731731AbgJLNrx (ORCPT ); Mon, 12 Oct 2020 09:47:53 -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 52778221FF; Mon, 12 Oct 2020 13:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510403; bh=GX6nnHML4AM6NNE6b6Q8vBRIzpI641Juvv6LGFS7jps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TxA4eRjVf0w1CgBqPtPqwiH31dSy1r1aXwlNbpaNxsIIdVSrdtDnBNpso+t+um8uL 1i8BSqtBvnFMjpOFeWfplXxHkOTdHwxh/HQBVTQSaDGJh3dJd2wQR08fid8Od8/GrB vznef+ETy7Yls7XUdFeUTA9TV99DGaPK7l+tiITo= 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.8 054/124] xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate Date: Mon, 12 Oct 2020 15:30:58 +0200 Message-Id: <20201012133149.466589499@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012133146.834528783@linuxfoundation.org> References: <20201012133146.834528783@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 51f65d23ebafa..2e32cb10ac16b 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1767,21 +1767,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