diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 4bb1ff9fd15b..95bd3fd75f94 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -218,9 +218,11 @@ struct sock { | |||
218 | #define sk_hash __sk_common.skc_hash | 218 | #define sk_hash __sk_common.skc_hash |
219 | #define sk_prot __sk_common.skc_prot | 219 | #define sk_prot __sk_common.skc_prot |
220 | #define sk_net __sk_common.skc_net | 220 | #define sk_net __sk_common.skc_net |
221 | kmemcheck_bitfield_begin(flags); | ||
221 | unsigned char sk_shutdown : 2, | 222 | unsigned char sk_shutdown : 2, |
222 | sk_no_check : 2, | 223 | sk_no_check : 2, |
223 | sk_userlocks : 4; | 224 | sk_userlocks : 4; |
225 | kmemcheck_bitfield_end(flags); | ||
224 | unsigned char sk_protocol; | 226 | unsigned char sk_protocol; |
225 | unsigned short sk_type; | 227 | unsigned short sk_type; |
226 | int sk_rcvbuf; | 228 | int sk_rcvbuf; |
@@ -1217,9 +1219,13 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
1217 | 1219 | ||
1218 | static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) | 1220 | static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) |
1219 | { | 1221 | { |
1220 | sock_hold(sk); | ||
1221 | skb->sk = sk; | 1222 | skb->sk = sk; |
1222 | skb->destructor = sock_wfree; | 1223 | skb->destructor = sock_wfree; |
1224 | /* | ||
1225 | * We used to take a refcount on sk, but following operation | ||
1226 | * is enough to guarantee sk_free() wont free this sock until | ||
1227 | * all in-flight packets are completed | ||
1228 | */ | ||
1223 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); | 1229 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); |
1224 | } | 1230 | } |
1225 | 1231 | ||