aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-10 16:40:59 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:48 -0400
commit7e28ecc282574a7d72ace365fc9bc86e27ba880f (patch)
tree6321d16c591694d6405b723f7bea80855b8040ce
parente2d1bca7e6134671bcb19810d004a252aa6a644d (diff)
[SK_BUFF]: Use skb_reset_network_header where the skb_pull return was being used
But only in the cases where its a newly allocated skb, i.e. one where skb->tail is equal to skb->data, or just after skb_reserve, where this requirement is maintained. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/appletalk/aarp.c12
-rw-r--r--net/ipv4/igmp.c8
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipx/af_ipx.c4
-rw-r--r--net/ipx/ipx_route.c4
5 files changed, 24 insertions, 8 deletions
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index d4e5ba22e246..de495c57aa90 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -118,7 +118,9 @@ static void __aarp_send_query(struct aarp_entry *a)
118 118
119 /* Set up the buffer */ 119 /* Set up the buffer */
120 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); 120 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
121 skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah)); 121 skb_reset_network_header(skb);
122 skb->h.raw = skb->data;
123 skb_put(skb, sizeof(*eah));
122 skb->protocol = htons(ETH_P_ATALK); 124 skb->protocol = htons(ETH_P_ATALK);
123 skb->dev = dev; 125 skb->dev = dev;
124 eah = aarp_hdr(skb); 126 eah = aarp_hdr(skb);
@@ -163,7 +165,9 @@ static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us,
163 165
164 /* Set up the buffer */ 166 /* Set up the buffer */
165 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); 167 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
166 skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah)); 168 skb_reset_network_header(skb);
169 skb->h.raw = skb->data;
170 skb_put(skb, sizeof(*eah));
167 skb->protocol = htons(ETH_P_ATALK); 171 skb->protocol = htons(ETH_P_ATALK);
168 skb->dev = dev; 172 skb->dev = dev;
169 eah = aarp_hdr(skb); 173 eah = aarp_hdr(skb);
@@ -212,7 +216,9 @@ static void aarp_send_probe(struct net_device *dev, struct atalk_addr *us)
212 216
213 /* Set up the buffer */ 217 /* Set up the buffer */
214 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); 218 skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
215 skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah)); 219 skb_reset_network_header(skb);
220 skb->h.raw = skb->data;
221 skb_put(skb, sizeof(*eah));
216 skb->protocol = htons(ETH_P_ATALK); 222 skb->protocol = htons(ETH_P_ATALK);
217 skb->dev = dev; 223 skb->dev = dev;
218 eah = aarp_hdr(skb); 224 eah = aarp_hdr(skb);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 8cedb2a2c9df..d17ad09a83e0 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -314,7 +314,9 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
314 314
315 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 315 skb_reserve(skb, LL_RESERVED_SPACE(dev));
316 316
317 skb->nh.iph = pip =(struct iphdr *)skb_put(skb, sizeof(struct iphdr)+4); 317 skb_reset_network_header(skb);
318 pip = skb->nh.iph;
319 skb_put(skb, sizeof(struct iphdr) + 4);
318 320
319 pip->version = 4; 321 pip->version = 4;
320 pip->ihl = (sizeof(struct iphdr)+4)>>2; 322 pip->ihl = (sizeof(struct iphdr)+4)>>2;
@@ -664,7 +666,9 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc,
664 666
665 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 667 skb_reserve(skb, LL_RESERVED_SPACE(dev));
666 668
667 skb->nh.iph = iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)+4); 669 skb_reset_network_header(skb);
670 iph = skb->nh.iph;
671 skb_put(skb, sizeof(struct iphdr) + 4);
668 672
669 iph->version = 4; 673 iph->version = 4;
670 iph->ihl = (sizeof(struct iphdr)+4)>>2; 674 iph->ihl = (sizeof(struct iphdr)+4)>>2;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 87e9c1618100..67e5e3c035c1 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -291,7 +291,9 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
291 skb->priority = sk->sk_priority; 291 skb->priority = sk->sk_priority;
292 skb->dst = dst_clone(&rt->u.dst); 292 skb->dst = dst_clone(&rt->u.dst);
293 293
294 skb->nh.iph = iph = (struct iphdr *)skb_put(skb, length); 294 skb_reset_network_header(skb);
295 iph = skb->nh.iph;
296 skb_put(skb, length);
295 297
296 skb->ip_summed = CHECKSUM_NONE; 298 skb->ip_summed = CHECKSUM_NONE;
297 299
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 6c6c0a3a0ab5..9aa7b961b3eb 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -576,7 +576,9 @@ static struct sk_buff *ipxitf_adjust_skbuff(struct ipx_interface *intrfc,
576 skb2 = alloc_skb(len, GFP_ATOMIC); 576 skb2 = alloc_skb(len, GFP_ATOMIC);
577 if (skb2) { 577 if (skb2) {
578 skb_reserve(skb2, out_offset); 578 skb_reserve(skb2, out_offset);
579 skb2->nh.raw = skb2->h.raw = skb_put(skb2, skb->len); 579 skb_reset_network_header(skb2);
580 skb2->h.raw = skb2->data;
581 skb_put(skb2, skb->len);
580 memcpy(ipx_hdr(skb2), ipx_hdr(skb), skb->len); 582 memcpy(ipx_hdr(skb2), ipx_hdr(skb), skb->len);
581 memcpy(skb2->cb, skb->cb, sizeof(skb->cb)); 583 memcpy(skb2->cb, skb->cb, sizeof(skb->cb));
582 } 584 }
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c
index 8e1cad971f11..e8277f544e72 100644
--- a/net/ipx/ipx_route.c
+++ b/net/ipx/ipx_route.c
@@ -203,7 +203,9 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
203 skb->sk = sk; 203 skb->sk = sk;
204 204
205 /* Fill in IPX header */ 205 /* Fill in IPX header */
206 skb->h.raw = skb->nh.raw = skb_put(skb, sizeof(struct ipxhdr)); 206 skb_reset_network_header(skb);
207 skb->h.raw = skb->data;
208 skb_put(skb, sizeof(struct ipxhdr));
207 ipx = ipx_hdr(skb); 209 ipx = ipx_hdr(skb);
208 ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr)); 210 ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr));
209 IPX_SKB_CB(skb)->ipx_tctrl = 0; 211 IPX_SKB_CB(skb)->ipx_tctrl = 0;