aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 4bb1ff9fd15b..010e14a93c92 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1217,9 +1217,13 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1217 1217
1218static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) 1218static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
1219{ 1219{
1220 sock_hold(sk);
1221 skb->sk = sk; 1220 skb->sk = sk;
1222 skb->destructor = sock_wfree; 1221 skb->destructor = sock_wfree;
1222 /*
1223 * We used to take a refcount on sk, but following operation
1224 * is enough to guarantee sk_free() wont free this sock until
1225 * all in-flight packets are completed
1226 */
1223 atomic_add(skb->truesize, &sk->sk_wmem_alloc); 1227 atomic_add(skb->truesize, &sk->sk_wmem_alloc);
1224} 1228}
1225 1229