aboutsummaryrefslogtreecommitdiff
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-06-11 16:00:49 +0200
committerPatrick McHardy <kaber@trash.net>2009-06-11 16:00:49 +0200
commit36432dae73cf2c90a59b39c8df9fd8219272b005 (patch)
tree660b9104305a809ec4fdeb295ca13d6e90790ecc /include/net/sock.h
parent440f0d588555892601cfe511728a0fc0c8204063 (diff)
parentbb400801c2f40bbd9a688818323ad09abfc4e581 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
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 4bb1ff9fd15..010e14a93c9 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,
static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
{
- sock_hold(sk);
skb->sk = sk;
skb->destructor = sock_wfree;
+ /*
+ * We used to take a refcount on sk, but following operation
+ * is enough to guarantee sk_free() wont free this sock until
+ * all in-flight packets are completed
+ */
atomic_add(skb->truesize, &sk->sk_wmem_alloc);
}