aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/xfrm.h4
-rw-r--r--net/key/af_key.c6
-rw-r--r--net/xfrm/xfrm_policy.c4
-rw-r--r--net/xfrm/xfrm_user.c2
4 files changed, 7 insertions, 9 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index a419a4372e2..5ebb9ba479b 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -626,12 +626,12 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy)
626 atomic_inc(&policy->refcnt); 626 atomic_inc(&policy->refcnt);
627} 627}
628 628
629extern void __xfrm_policy_destroy(struct xfrm_policy *policy); 629extern void xfrm_policy_destroy(struct xfrm_policy *policy);
630 630
631static inline void xfrm_pol_put(struct xfrm_policy *policy) 631static inline void xfrm_pol_put(struct xfrm_policy *policy)
632{ 632{
633 if (atomic_dec_and_test(&policy->refcnt)) 633 if (atomic_dec_and_test(&policy->refcnt))
634 __xfrm_policy_destroy(policy); 634 xfrm_policy_destroy(policy);
635} 635}
636 636
637#ifdef CONFIG_XFRM_SUB_POLICY 637#ifdef CONFIG_XFRM_SUB_POLICY
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 76dcd882f87..16b72b5570c 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2291,8 +2291,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2291 return 0; 2291 return 0;
2292 2292
2293out: 2293out:
2294 security_xfrm_policy_free(xp); 2294 xfrm_policy_destroy(xp);
2295 kfree(xp);
2296 return err; 2295 return err;
2297} 2296}
2298 2297
@@ -3236,8 +3235,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
3236 return xp; 3235 return xp;
3237 3236
3238out: 3237out:
3239 security_xfrm_policy_free(xp); 3238 xfrm_policy_destroy(xp);
3240 kfree(xp);
3241 return NULL; 3239 return NULL;
3242} 3240}
3243 3241
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index d83227baaa0..534b29eb46f 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(xfrm_policy_alloc);
221 221
222/* Destroy xfrm_policy: descendant resources must be released to this moment. */ 222/* Destroy xfrm_policy: descendant resources must be released to this moment. */
223 223
224void __xfrm_policy_destroy(struct xfrm_policy *policy) 224void xfrm_policy_destroy(struct xfrm_policy *policy)
225{ 225{
226 BUG_ON(!policy->dead); 226 BUG_ON(!policy->dead);
227 227
@@ -233,7 +233,7 @@ void __xfrm_policy_destroy(struct xfrm_policy *policy)
233 security_xfrm_policy_free(policy); 233 security_xfrm_policy_free(policy);
234 kfree(policy); 234 kfree(policy);
235} 235}
236EXPORT_SYMBOL(__xfrm_policy_destroy); 236EXPORT_SYMBOL(xfrm_policy_destroy);
237 237
238static void xfrm_policy_gc_kill(struct xfrm_policy *policy) 238static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
239{ 239{
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 6424e536051..35fc16ae50a 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1043,7 +1043,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
1043 return xp; 1043 return xp;
1044 error: 1044 error:
1045 *errp = err; 1045 *errp = err;
1046 kfree(xp); 1046 xfrm_policy_destroy(xp);
1047 return NULL; 1047 return NULL;
1048} 1048}
1049 1049