[PPP] pppoe: Fix skb_unshare_check call position
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 16 Sep 2007 23:19:20 +0000 (16:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Sep 2007 23:19:20 +0000 (16:19 -0700)
The skb_unshare_check call needs to be made before pskb_may_pull,
not after.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pppoe.c

index 68631a5721ac1046774450c168be665808dd9cd5..5ac3eff6a2a6a80793168084dd3288d957151db0 100644 (file)
@@ -385,12 +385,12 @@ static int pppoe_rcv(struct sk_buff *skb,
        struct pppoe_hdr *ph;
        struct pppox_sock *po;
 
-       if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
-               goto drop;
-
        if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
                goto out;
 
+       if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
+               goto drop;
+
        ph = pppoe_hdr(skb);
 
        po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source, dev->ifindex);