]> err.no Git - linux-2.6/commitdiff
[XFRM] xfrm_policy_destroy: Rename and relative fixes.
authorWANG Cong <xiyou.wangcong@gmail.com>
Tue, 8 Jan 2008 06:34:29 +0000 (22:34 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:00:46 +0000 (15:00 -0800)
Since __xfrm_policy_destroy is used to destory the resources
allocated by xfrm_policy_alloc. So using the name
__xfrm_policy_destroy is not correspond with xfrm_policy_alloc.
Rename it to xfrm_policy_destroy.

And along with some instances that call xfrm_policy_alloc
but not using xfrm_policy_destroy to destroy the resource,
fix them.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/xfrm.h
net/key/af_key.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_user.c

index a419a4372e2149273613db383da45db05aa4c8b5..5ebb9ba479b107edfb11c582390c478100bee7f3 100644 (file)
@@ -626,12 +626,12 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy)
                atomic_inc(&policy->refcnt);
 }
 
-extern void __xfrm_policy_destroy(struct xfrm_policy *policy);
+extern void xfrm_policy_destroy(struct xfrm_policy *policy);
 
 static inline void xfrm_pol_put(struct xfrm_policy *policy)
 {
        if (atomic_dec_and_test(&policy->refcnt))
-               __xfrm_policy_destroy(policy);
+               xfrm_policy_destroy(policy);
 }
 
 #ifdef CONFIG_XFRM_SUB_POLICY
index 76dcd882f87b97e3c5195fe96e9e0a9eb5178c78..16b72b5570c303831aca6353d6a35b4ae901b473 100644 (file)
@@ -2291,8 +2291,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
        return 0;
 
 out:
-       security_xfrm_policy_free(xp);
-       kfree(xp);
+       xfrm_policy_destroy(xp);
        return err;
 }
 
@@ -3236,8 +3235,7 @@ static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
        return xp;
 
 out:
-       security_xfrm_policy_free(xp);
-       kfree(xp);
+       xfrm_policy_destroy(xp);
        return NULL;
 }
 
index d83227baaa093f1103e3593bfa3c62df6c8e09ed..534b29eb46fe7bc02dd1e79ab11020fba40c7fd9 100644 (file)
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(xfrm_policy_alloc);
 
 /* Destroy xfrm_policy: descendant resources must be released to this moment. */
 
-void __xfrm_policy_destroy(struct xfrm_policy *policy)
+void xfrm_policy_destroy(struct xfrm_policy *policy)
 {
        BUG_ON(!policy->dead);
 
@@ -233,7 +233,7 @@ void __xfrm_policy_destroy(struct xfrm_policy *policy)
        security_xfrm_policy_free(policy);
        kfree(policy);
 }
-EXPORT_SYMBOL(__xfrm_policy_destroy);
+EXPORT_SYMBOL(xfrm_policy_destroy);
 
 static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
 {
index 6424e53605118223981f04a8e367fba72cd7dabc..35fc16ae50ac717cbaf1f314aa8e8ec1299366cc 100644 (file)
@@ -1043,7 +1043,7 @@ static struct xfrm_policy *xfrm_policy_construct(struct xfrm_userpolicy_info *p,
        return xp;
  error:
        *errp = err;
-       kfree(xp);
+       xfrm_policy_destroy(xp);
        return NULL;
 }