]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/core/sock.c
net: Introduce sk_clone_lock() error path routine
[linux.git] / net / core / sock.c
index e7d74940e8637dfe0a5b6629f1d1bff827a62073..f6fd79f33097f3fa279fcb0b610286259af9b111 100644 (file)
@@ -1539,11 +1539,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
                        is_charged = sk_filter_charge(newsk, filter);
 
                if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) {
-                       /* It is still raw copy of parent, so invalidate
-                        * destructor and make plain sk_free() */
-                       newsk->sk_destruct = NULL;
-                       bh_unlock_sock(newsk);
-                       sk_free(newsk);
+                       sk_free_unlock_clone(newsk);
                        newsk = NULL;
                        goto out;
                }
@@ -1592,6 +1588,16 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
 }
 EXPORT_SYMBOL_GPL(sk_clone_lock);
 
+void sk_free_unlock_clone(struct sock *sk)
+{
+       /* It is still raw copy of parent, so invalidate
+        * destructor and make plain sk_free() */
+       sk->sk_destruct = NULL;
+       bh_unlock_sock(sk);
+       sk_free(sk);
+}
+EXPORT_SYMBOL_GPL(sk_free_unlock_clone);
+
 void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
 {
        u32 max_segs = 1;