Skip to content

Commit

Permalink
pppoe: Unshare skb before anything else
Browse files Browse the repository at this point in the history
We need to unshare the skb first as otherwise pskb_may_pull may
write to a shared skb which could be bad.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jun 10, 2008
1 parent 392fdb0 commit bc6cffd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,12 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
if (dev_net(dev) != &init_net)
goto abort;

if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
goto abort;

if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
goto out;

if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
goto abort;

ph = pppoe_hdr(skb);
if (ph->code != PADT_CODE)
goto abort;
Expand Down

0 comments on commit bc6cffd

Please sign in to comment.