[net] xfrm_user: use xfrm_state_put to free xfrm_state_alloc return value

From: Pan Bian
Date: Wed Nov 21 2018 - 01:58:23 EST


From: Pan Bian <bianpan2013@xxxxxxx>

The memory chunk allocated by xfrm_state_alloc() should be released with
xfrm_state_put(), not kfree.

Signed-off-by: Pan Bian <bianpan2013@xxxxxxx>
---
net/xfrm/xfrm_user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c9a84e2..267922c 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2288,13 +2288,13 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,

}

- kfree(x);
+ xfrm_state_put(x);
kfree(xp);

return 0;

free_state:
- kfree(x);
+ xfrm_state_put(x);
nomem:
return err;
}
--
2.7.4