diff options
-rw-r--r-- | include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | net/core/dev.c | 11 |
2 files changed, 4 insertions, 9 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 31167451d08..c9ef4191607 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1137,7 +1137,7 @@ static inline void skb_gro_reset_offset(struct sk_buff *skb) | |||
1137 | 1137 | ||
1138 | static inline void *skb_gro_mac_header(struct sk_buff *skb) | 1138 | static inline void *skb_gro_mac_header(struct sk_buff *skb) |
1139 | { | 1139 | { |
1140 | return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : | 1140 | return skb_headlen(skb) ? skb_mac_header(skb) : |
1141 | page_address(skb_shinfo(skb)->frags[0].page) + | 1141 | page_address(skb_shinfo(skb)->frags[0].page) + |
1142 | skb_shinfo(skb)->frags[0].page_offset; | 1142 | skb_shinfo(skb)->frags[0].page_offset; |
1143 | } | 1143 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index e48c08af76a..6785b067ad5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2378,18 +2378,13 @@ void *skb_gro_header(struct sk_buff *skb, unsigned int hlen) | |||
2378 | unsigned int offset = skb_gro_offset(skb); | 2378 | unsigned int offset = skb_gro_offset(skb); |
2379 | 2379 | ||
2380 | hlen += offset; | 2380 | hlen += offset; |
2381 | if (hlen <= skb_headlen(skb)) | 2381 | if (unlikely(skb_headlen(skb) || |
2382 | return skb->data + offset; | 2382 | skb_shinfo(skb)->frags[0].size < hlen || |
2383 | |||
2384 | if (unlikely(!skb_shinfo(skb)->nr_frags || | ||
2385 | skb_shinfo(skb)->frags[0].size <= | ||
2386 | hlen - skb_headlen(skb) || | ||
2387 | PageHighMem(skb_shinfo(skb)->frags[0].page))) | 2383 | PageHighMem(skb_shinfo(skb)->frags[0].page))) |
2388 | return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; | 2384 | return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; |
2389 | 2385 | ||
2390 | return page_address(skb_shinfo(skb)->frags[0].page) + | 2386 | return page_address(skb_shinfo(skb)->frags[0].page) + |
2391 | skb_shinfo(skb)->frags[0].page_offset + | 2387 | skb_shinfo(skb)->frags[0].page_offset + offset; |
2392 | offset - skb_headlen(skb); | ||
2393 | } | 2388 | } |
2394 | EXPORT_SYMBOL(skb_gro_header); | 2389 | EXPORT_SYMBOL(skb_gro_header); |
2395 | 2390 | ||