[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1IR2XP-0007QP-00@gondolin.me.apana.org.au>
Date: Fri, 31 Aug 2007 17:11:35 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: James Chapman <jchapman@...alix.com>,
"David S. Miller" <davem@...emloft.net>,
Michal Ostrowski <mostrows@...akeasy.net>,
Paul Mackerras <paulus@...ba.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Toralf F?rster <toralf.foerster@....de>, netdev@...r.kernel.org
Subject: [PATCH 6/7] [PPP] generic: Call skb_cow_head before scribbling over skb
[PPP] generic: Call skb_cow_head before scribbling over skb
It's rude to write over data that other people are still using. So call
skb_cow_head before PPP proceeds to modify the skb data.
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
---
drivers/net/ppp_generic.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 9293c82..7e21342 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -899,17 +899,9 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Put the 2-byte PPP protocol number on the front,
making sure there is room for the address and control fields. */
- if (skb_headroom(skb) < PPP_HDRLEN) {
- struct sk_buff *ns;
-
- ns = alloc_skb(skb->len + dev->hard_header_len, GFP_ATOMIC);
- if (ns == 0)
- goto outf;
- skb_reserve(ns, dev->hard_header_len);
- skb_copy_bits(skb, 0, skb_put(ns, skb->len), skb->len);
- kfree_skb(skb);
- skb = ns;
- }
+ if (skb_cow_head(skb, PPP_HDRLEN))
+ goto outf;
+
pp = skb_push(skb, 2);
proto = npindex_to_proto[npi];
pp[0] = proto >> 8;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists