Skip to content

Commit bc6cffd

Browse files
herbertxdavem330
authored andcommitted
pppoe: Unshare skb before anything else
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>
1 parent 392fdb0 commit bc6cffd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/pppoe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,12 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
432432
if (dev_net(dev) != &init_net)
433433
goto abort;
434434

435-
if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
436-
goto abort;
437-
438435
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
439436
goto out;
440437

438+
if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
439+
goto abort;
440+
441441
ph = pppoe_hdr(skb);
442442
if (ph->code != PADT_CODE)
443443
goto abort;

0 commit comments

Comments
 (0)