netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pppoe: Unshare skb before anything else
@ 2008-06-08  6:29 Herbert Xu
  2008-06-08 10:08 ` James Chapman
  2008-06-10 21:08 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Herbert Xu @ 2008-06-08  6:29 UTC (permalink / raw)
  To: David S. Miller, netdev

Hi Dave:

I noticed that my last patch to move the unshare in pppoe missed
the other spot which did the same thing:

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>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 58a26a4..3586d4a 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -427,12 +427,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;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-10 22:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-08  6:29 pppoe: Unshare skb before anything else Herbert Xu
2008-06-08 10:08 ` James Chapman
2008-06-10 21:09   ` David Miller
2008-06-10 21:44     ` James Chapman
2008-06-10 22:01       ` David Miller
2008-06-10 21:08 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).