diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-09-16 19:21:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-09-16 19:21:42 -0400 |
commit | 7b797d5b150775d717cb03b5ada28b8bad99afab (patch) | |
tree | 086b28889711612bcb2ea80c30e85116f617c0f7 | |
parent | d9cc20484e5e48c6a5deb4387c20fd45bfbdde8c (diff) |
[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@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | 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 9293c82ef2af..7e21342becb2 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) | |||
899 | 899 | ||
900 | /* Put the 2-byte PPP protocol number on the front, | 900 | /* Put the 2-byte PPP protocol number on the front, |
901 | making sure there is room for the address and control fields. */ | 901 | making sure there is room for the address and control fields. */ |
902 | if (skb_headroom(skb) < PPP_HDRLEN) { | 902 | if (skb_cow_head(skb, PPP_HDRLEN)) |
903 | struct sk_buff *ns; | 903 | goto outf; |
904 | 904 | ||
905 | ns = alloc_skb(skb->len + dev->hard_header_len, GFP_ATOMIC); | ||
906 | if (ns == 0) | ||
907 | goto outf; | ||
908 | skb_reserve(ns, dev->hard_header_len); | ||
909 | skb_copy_bits(skb, 0, skb_put(ns, skb->len), skb->len); | ||
910 | kfree_skb(skb); | ||
911 | skb = ns; | ||
912 | } | ||
913 | pp = skb_push(skb, 2); | 905 | pp = skb_push(skb, 2); |
914 | proto = npindex_to_proto[npi]; | 906 | proto = npindex_to_proto[npi]; |
915 | pp[0] = proto >> 8; | 907 | pp[0] = proto >> 8; |