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

* Re: pppoe: Unshare skb before anything else
  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:08 ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: James Chapman @ 2008-06-08 10:08 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

Herbert Xu wrote:
> 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.

The same problem exists in the pppol2tp driver. Patch to follow. I'm 
also fixing the copy-to-iovec issue.

-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


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

* Re: pppoe: Unshare skb before anything else
  2008-06-08  6:29 pppoe: Unshare skb before anything else Herbert Xu
  2008-06-08 10:08 ` James Chapman
@ 2008-06-10 21:08 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2008-06-10 21:08 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sun, 8 Jun 2008 16:29:13 +1000

> 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>

Applied, and queued to -stable, thanks!

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

* Re: pppoe: Unshare skb before anything else
  2008-06-08 10:08 ` James Chapman
@ 2008-06-10 21:09   ` David Miller
  2008-06-10 21:44     ` James Chapman
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2008-06-10 21:09 UTC (permalink / raw)
  To: jchapman; +Cc: herbert, netdev

From: James Chapman <jchapman@katalix.com>
Date: Sun, 08 Jun 2008 11:08:59 +0100

> Herbert Xu wrote:
> > 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.
> 
> The same problem exists in the pppol2tp driver. Patch to follow. I'm 
> also fixing the copy-to-iovec issue.

I have the iovec patch, but I do not see the unshare one.
Did you post it?  Please resend if you have since I
don't have a copy.

Thanks.

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

* Re: pppoe: Unshare skb before anything else
  2008-06-10 21:09   ` David Miller
@ 2008-06-10 21:44     ` James Chapman
  2008-06-10 22:01       ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: James Chapman @ 2008-06-10 21:44 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev

David Miller wrote:
> From: James Chapman <jchapman@katalix.com>
> Date: Sun, 08 Jun 2008 11:08:59 +0100
> 
>> Herbert Xu wrote:
>>> 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.
>> The same problem exists in the pppol2tp driver. Patch to follow. I'm 
>> also fixing the copy-to-iovec issue.
> 
> I have the iovec patch, but I do not see the unshare one.
> Did you post it?  Please resend if you have since I
> don't have a copy.

I didn't send the patch. I realised when I was writing it that in L2TP's 
case, the unshare isn't needed because L2TP uses UDP encap sockets.

Sorry I forgot to let Herbert and netdev know.

-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


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

* Re: pppoe: Unshare skb before anything else
  2008-06-10 21:44     ` James Chapman
@ 2008-06-10 22:01       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-06-10 22:01 UTC (permalink / raw)
  To: jchapman; +Cc: herbert, netdev

From: James Chapman <jchapman@katalix.com>
Date: Tue, 10 Jun 2008 22:44:02 +0100

> David Miller wrote:
> > From: James Chapman <jchapman@katalix.com>
> > Date: Sun, 08 Jun 2008 11:08:59 +0100
> > 
> >> Herbert Xu wrote:
> >>> 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.
> >> The same problem exists in the pppol2tp driver. Patch to follow. I'm 
> >> also fixing the copy-to-iovec issue.
> > 
> > I have the iovec patch, but I do not see the unshare one.
> > Did you post it?  Please resend if you have since I
> > don't have a copy.
> 
> I didn't send the patch. I realised when I was writing it that in L2TP's 
> case, the unshare isn't needed because L2TP uses UDP encap sockets.
> 
> Sorry I forgot to let Herbert and netdev know.

Great, thanks for the info.

^ permalink raw reply	[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).