]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/bridge/br_netfilter.c
[POWERPC] Size swapper_pg_dir correctly
[linux-2.6-omap-h63xx.git] / net / bridge / br_netfilter.c
index fa779874b9dd3723335257e46b9e02def4682712..3ee2022928e32069d9978f77a3cdd88299d62d70 100644 (file)
@@ -509,8 +509,14 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
                                      int (*okfn)(struct sk_buff *))
 {
        struct iphdr *iph;
-       __u32 len;
        struct sk_buff *skb = *pskb;
+       __u32 len = nf_bridge_encap_header_len(skb);
+
+       if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
+               return NF_STOLEN;
+
+       if (unlikely(!pskb_may_pull(skb, len)))
+               goto out;
 
        if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6(skb) ||
            IS_PPPOE_IPV6(skb)) {
@@ -518,8 +524,6 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
                if (!brnf_call_ip6tables)
                        return NF_ACCEPT;
 #endif
-               if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL)
-                       goto out;
                nf_bridge_pull_encap_header_rcsum(skb);
                return br_nf_pre_routing_ipv6(hook, skb, in, out, okfn);
        }
@@ -532,8 +536,6 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb,
            !IS_PPPOE_IP(skb))
                return NF_ACCEPT;
 
-       if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL)
-               goto out;
        nf_bridge_pull_encap_header_rcsum(skb);
 
        if (!pskb_may_pull(skb, sizeof(struct iphdr)))