>From fced06475e82f328aede0370d26336bc8a48c333 Mon Sep 17 00:00:00 2001 From: Antony Antony Date: Thu, 29 Aug 2024 13:23:42 +0200 Subject: [PATCH] call iptfs state init only once during cloning. Signed-off-by: Antony Antony --- net/xfrm/xfrm_iptfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c index 7f7b3078ca70..aa18ee4733f8 100644 --- a/net/xfrm/xfrm_iptfs.c +++ b/net/xfrm/xfrm_iptfs.c @@ -2722,9 +2722,13 @@ static int iptfs_create_state(struct xfrm_state *x) { struct xfrm_iptfs_data *xtfs; - xtfs = kzalloc(sizeof(*xtfs), GFP_KERNEL); - if (!xtfs) - return -ENOMEM; + if (x->mode_data) { + xtfs = x->mode_data; + } else { + xtfs = kzalloc(sizeof(*xtfs), GFP_KERNEL); + if (!xtfs) + return -ENOMEM; + } __iptfs_init_state(x, xtfs); -- 2.43.0