diff options
author | Alex Shi <alex.shi@linaro.org> | 2015-03-19 08:57:07 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2015-03-19 08:57:07 +0800 |
commit | 42f45c9abdea541a9f966553b5e71dd576d432f9 (patch) | |
tree | e9189f804b03d19696b0944a5a34ea9427177646 /net/ipv4/ip_fragment.c | |
parent | 4d8fd56f051e5eea61209de4a3cb0619283a30af (diff) | |
parent | ba0bfedf4c9cad58f56a7038d1462ffc21cd33df (diff) |
Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-androidlsk-v3.10-15.03-android
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r-- | net/ipv4/ip_fragment.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index b66910aaef4d..4c1884fed548 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -678,27 +678,30 @@ EXPORT_SYMBOL(ip_defrag); struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) { struct iphdr iph; + int netoff; u32 len; if (skb->protocol != htons(ETH_P_IP)) return skb; - if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) + netoff = skb_network_offset(skb); + + if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) return skb; if (iph.ihl < 5 || iph.version != 4) return skb; len = ntohs(iph.tot_len); - if (skb->len < len || len < (iph.ihl * 4)) + if (skb->len < netoff + len || len < (iph.ihl * 4)) return skb; if (ip_is_fragment(&iph)) { skb = skb_share_check(skb, GFP_ATOMIC); if (skb) { - if (!pskb_may_pull(skb, iph.ihl*4)) + if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) return skb; - if (pskb_trim_rcsum(skb, len)) + if (pskb_trim_rcsum(skb, netoff + len)) return skb; memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); if (ip_defrag(skb, user)) |