aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c13
-rw-r--r--net/ipv4/tcp.c22
2 files changed, 26 insertions, 9 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 170689681aa2..644cc5535319 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1246,13 +1246,20 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
1246 struct sk_buff **pp = NULL; 1246 struct sk_buff **pp = NULL;
1247 struct sk_buff *p; 1247 struct sk_buff *p;
1248 struct iphdr *iph; 1248 struct iphdr *iph;
1249 unsigned int hlen;
1250 unsigned int off;
1249 int flush = 1; 1251 int flush = 1;
1250 int proto; 1252 int proto;
1251 int id; 1253 int id;
1252 1254
1253 iph = skb_gro_header(skb, sizeof(*iph)); 1255 off = skb_gro_offset(skb);
1254 if (unlikely(!iph)) 1256 hlen = off + sizeof(*iph);
1255 goto out; 1257 iph = skb_gro_header_fast(skb, off);
1258 if (skb_gro_header_hard(skb, hlen)) {
1259 iph = skb_gro_header_slow(skb, hlen, off);
1260 if (unlikely(!iph))
1261 goto out;
1262 }
1256 1263
1257 proto = iph->protocol & (MAX_INET_PROTOS - 1); 1264 proto = iph->protocol & (MAX_INET_PROTOS - 1);
1258 1265
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 68342d431896..c3dcec5efea5 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2518,20 +2518,30 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2518 unsigned int thlen; 2518 unsigned int thlen;
2519 unsigned int flags; 2519 unsigned int flags;
2520 unsigned int mss = 1; 2520 unsigned int mss = 1;
2521 unsigned int hlen;
2522 unsigned int off;
2521 int flush = 1; 2523 int flush = 1;
2522 int i; 2524 int i;
2523 2525
2524 th = skb_gro_header(skb, sizeof(*th)); 2526 off = skb_gro_offset(skb);
2525 if (unlikely(!th)) 2527 hlen = off + sizeof(*th);
2526 goto out; 2528 th = skb_gro_header_fast(skb, off);
2529 if (skb_gro_header_hard(skb, hlen)) {
2530 th = skb_gro_header_slow(skb, hlen, off);
2531 if (unlikely(!th))
2532 goto out;
2533 }
2527 2534
2528 thlen = th->doff * 4; 2535 thlen = th->doff * 4;
2529 if (thlen < sizeof(*th)) 2536 if (thlen < sizeof(*th))
2530 goto out; 2537 goto out;
2531 2538
2532 th = skb_gro_header(skb, thlen); 2539 hlen = off + thlen;
2533 if (unlikely(!th)) 2540 if (skb_gro_header_hard(skb, hlen)) {
2534 goto out; 2541 th = skb_gro_header_slow(skb, hlen, off);
2542 if (unlikely(!th))
2543 goto out;
2544 }
2535 2545
2536 skb_gro_pull(skb, thlen); 2546 skb_gro_pull(skb, thlen);
2537 2547