Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4408160pxu; Mon, 12 Oct 2020 19:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw64zdIXNwxn1vyT+JaKLNSns6wN4NZVPEGIRwYVW2WX/UDPe+dv71tcwdKQ1K6+4PVLz+b X-Received: by 2002:a17:906:7f8d:: with SMTP id f13mr31582851ejr.540.1602555601996; Mon, 12 Oct 2020 19:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602555601; cv=none; d=google.com; s=arc-20160816; b=exGdmdQWFRnqGqgRiMkCMTELUQxojhnhYYQgbWdQgYWPcjQ7nah8v+R3bnZD9LvLBz FTryfr42j+rHvcf5MAzR5c61unwhy+Eq/bePSsrcr3tVtT4h803ZKgKsF9myNh+ojqUq cV06q/quC9yWEe9aVNi62fKu4AORwqeqomd/bIvbMcwm+oLhdRomC2g+1O4YZOx1bIPZ k7PdLSxi9FG0irxk+0GLDzdLo9sz0OUn/3jQuMjZvzikgosHz8dBiu8JPVzNBSu1on1T 85InWj5YFk54Pxj54qHtbnr7Oc7Wsvmi0qsa/dxNxfFfmP/jevhbg4j3uR3fCNu0LvF1 1eMw== 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=bgllAr4BEROUllvAQZN4Rg0H5lU5ZyXpXcSP78RJKPg=; b=oj2GQxOidJ1gaVL3PNgd8/v3pUVomnxx9tanf6nG8RWHBMNgb8lupFLh/uKQQQpVMJ QbdDdMPzIFIKp/4xl4fU76NxIgJ0MV9gnmNnXx1jf9tynIEu/7czEg0DszQCyVsL7tDY ITiX0XCoJsdKzfPAdmipFf0MyqDhMrpFg1UXmDFDMHKaZybo5vdAMT+BY7IrVcC/SqOQ CMxmSwp3gx5JiDPKmjXtaTnja4J+wHXuQFAieSEUyL0yag1KNH+E0Deffr+PtgvZtdKa eRDhvvjYoJfnDzbALkkGgy0SHZW++PkWqeHsIDdi2/PQd7/TBEKqiEgH1/BpeTP1zlGe ctwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rLhQwJHb; 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 k10si4721035ejq.208.2020.10.12.19.19.40; Mon, 12 Oct 2020 19:20:01 -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=rLhQwJHb; 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 S1731160AbgJLOBf (ORCPT + 99 others); Mon, 12 Oct 2020 10:01:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:41654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731137AbgJLNiO (ORCPT ); Mon, 12 Oct 2020 09:38:14 -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 2B82D20878; Mon, 12 Oct 2020 13:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509893; bh=uq6qvqO3FjtwUjLOU+NwnGrIC6pZlDYOHE+3f3ensts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLhQwJHbnItwZWGVifiFcTSrpELLtzIxN/+mk+ANu3XXpGy2ESbA2zvcw0QPuGaMo oevFgxvsqIWZyLzGlJ2f2xYBxQBToGyZ2edD6/B3KsJxpxUw9O95CJkksAfN+oj+nS HCBPY1nVHk9ST/AuCGgGK+/khePZtRYbuxb1wHAA= 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 4.14 54/70] xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate Date: Mon, 12 Oct 2020 15:27:10 +0200 Message-Id: <20201012132632.777777307@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132630.201442517@linuxfoundation.org> References: <20201012132630.201442517@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 57b8b11cf7d42..86ff111574496 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1808,21 +1808,17 @@ static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay 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