Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336263
b: refs/heads/master
c: 1bf3751
h: refs/heads/master
i:
  336261: e309e2b
  336259: a364e62
  336255: 0b2052c
v: v3
  • Loading branch information
Johannes Berg authored and David S. Miller committed Dec 10, 2012
1 parent 21e1974 commit 2e0ed14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e1f54201cb481f40a04bc47e1bc8c093a189e23
refs/heads/master: 1bf3751ec90cc3174e01f0d701e8449ce163d113
19 changes: 9 additions & 10 deletions trunk/net/ipv4/ip_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,28 +707,27 @@ EXPORT_SYMBOL(ip_defrag);

struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
{
const struct iphdr *iph;
struct iphdr iph;
u32 len;

if (skb->protocol != htons(ETH_P_IP))
return skb;

if (!pskb_may_pull(skb, sizeof(struct iphdr)))
if (!skb_copy_bits(skb, 0, &iph, sizeof(iph)))
return skb;

iph = ip_hdr(skb);
if (iph->ihl < 5 || iph->version != 4)
if (iph.ihl < 5 || iph.version != 4)
return skb;
if (!pskb_may_pull(skb, iph->ihl*4))
return skb;
iph = ip_hdr(skb);
len = ntohs(iph->tot_len);
if (skb->len < len || len < (iph->ihl * 4))

len = ntohs(iph.tot_len);
if (skb->len < len || len < (iph.ihl * 4))
return skb;

if (ip_is_fragment(ip_hdr(skb))) {
if (ip_is_fragment(&iph)) {
skb = skb_share_check(skb, GFP_ATOMIC);
if (skb) {
if (!pskb_may_pull(skb, iph.ihl*4))
return skb;
if (pskb_trim_rcsum(skb, len))
return skb;
memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
Expand Down

0 comments on commit 2e0ed14

Please sign in to comment.