summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorAntony Antony <antony.antony@secunet.com>2020-09-04 09:49:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 11:31:24 +0300
commitfb48241729bd18dfa252f0e60ea88f331f10e968 (patch)
tree7d1714aed8cf372cab29df0fd7628ce32e815d06 /include/net
parent50e117921b322323b7272f108d9c080ad883ee0a (diff)
downloadlinux-fb48241729bd18dfa252f0e60ea88f331f10e968.tar.xz
xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate
[ 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 <antony.antony@secunet.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/xfrm.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 3a0b5de742e9..fe8bed557691 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1873,21 +1873,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;
}