diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index e593af5b1ecc..7b76f891ae2d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1134,13 +1134,16 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) | |||
1134 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | 1134 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, |
1135 | int size, int mem, int gfp) | 1135 | int size, int mem, int gfp) |
1136 | { | 1136 | { |
1137 | struct sk_buff *skb = alloc_skb(size + sk->sk_prot->max_header, gfp); | 1137 | struct sk_buff *skb; |
1138 | int hdr_len; | ||
1138 | 1139 | ||
1140 | hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); | ||
1141 | skb = alloc_skb(size + hdr_len, gfp); | ||
1139 | if (skb) { | 1142 | if (skb) { |
1140 | skb->truesize += mem; | 1143 | skb->truesize += mem; |
1141 | if (sk->sk_forward_alloc >= (int)skb->truesize || | 1144 | if (sk->sk_forward_alloc >= (int)skb->truesize || |
1142 | sk_stream_mem_schedule(sk, skb->truesize, 0)) { | 1145 | sk_stream_mem_schedule(sk, skb->truesize, 0)) { |
1143 | skb_reserve(skb, sk->sk_prot->max_header); | 1146 | skb_reserve(skb, hdr_len); |
1144 | return skb; | 1147 | return skb; |
1145 | } | 1148 | } |
1146 | __kfree_skb(skb); | 1149 | __kfree_skb(skb); |