aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2012-09-24 14:12:24 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-27 18:12:37 -0400
commit0c5794a66c7c6443759e6098841767958a031187 (patch)
treebc5206b2ce2fa58fc47f6d94fabc7c1bb9fa6f78 /net/ipv4
parentd208328765a0ab425e36b5b828285f3337a85451 (diff)
gre: remove unnecessary rcu_read_lock/unlock
The gre function pointers for receive and error handling are always called (from gre.c) with rcu_read_lock already held. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_gre.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 0d4c3832d490..1c012cb2cb94 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -557,37 +557,34 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
557 break; 557 break;
558 } 558 }
559 559
560 rcu_read_lock();
561 t = ipgre_tunnel_lookup(skb->dev, iph->daddr, iph->saddr, 560 t = ipgre_tunnel_lookup(skb->dev, iph->daddr, iph->saddr,
562 flags, key, p[1]); 561 flags, key, p[1]);
563 562
564 if (t == NULL) 563 if (t == NULL)
565 goto out; 564 return;
566 565
567 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { 566 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
568 ipv4_update_pmtu(skb, dev_net(skb->dev), info, 567 ipv4_update_pmtu(skb, dev_net(skb->dev), info,
569 t->parms.link, 0, IPPROTO_GRE, 0); 568 t->parms.link, 0, IPPROTO_GRE, 0);
570 goto out; 569 return;
571 } 570 }
572 if (type == ICMP_REDIRECT) { 571 if (type == ICMP_REDIRECT) {
573 ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0, 572 ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0,
574 IPPROTO_GRE, 0); 573 IPPROTO_GRE, 0);
575 goto out; 574 return;
576 } 575 }
577 if (t->parms.iph.daddr == 0 || 576 if (t->parms.iph.daddr == 0 ||
578 ipv4_is_multicast(t->parms.iph.daddr)) 577 ipv4_is_multicast(t->parms.iph.daddr))
579 goto out; 578 return;
580 579
581 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) 580 if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED)
582 goto out; 581 return;
583 582
584 if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO)) 583 if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO))
585 t->err_count++; 584 t->err_count++;
586 else 585 else
587 t->err_count = 1; 586 t->err_count = 1;
588 t->err_time = jiffies; 587 t->err_time = jiffies;
589out:
590 rcu_read_unlock();
591} 588}
592 589
593static inline void ipgre_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb) 590static inline void ipgre_ecn_decapsulate(const struct iphdr *iph, struct sk_buff *skb)
@@ -625,7 +622,7 @@ static int ipgre_rcv(struct sk_buff *skb)
625 __be16 gre_proto; 622 __be16 gre_proto;
626 623
627 if (!pskb_may_pull(skb, 16)) 624 if (!pskb_may_pull(skb, 16))
628 goto drop_nolock; 625 goto drop;
629 626
630 iph = ip_hdr(skb); 627 iph = ip_hdr(skb);
631 h = skb->data; 628 h = skb->data;
@@ -636,7 +633,7 @@ static int ipgre_rcv(struct sk_buff *skb)
636 - We do not support routing headers. 633 - We do not support routing headers.
637 */ 634 */
638 if (flags&(GRE_VERSION|GRE_ROUTING)) 635 if (flags&(GRE_VERSION|GRE_ROUTING))
639 goto drop_nolock; 636 goto drop;
640 637
641 if (flags&GRE_CSUM) { 638 if (flags&GRE_CSUM) {
642 switch (skb->ip_summed) { 639 switch (skb->ip_summed) {
@@ -664,7 +661,6 @@ static int ipgre_rcv(struct sk_buff *skb)
664 661
665 gre_proto = *(__be16 *)(h + 2); 662 gre_proto = *(__be16 *)(h + 2);
666 663
667 rcu_read_lock();
668 tunnel = ipgre_tunnel_lookup(skb->dev, 664 tunnel = ipgre_tunnel_lookup(skb->dev,
669 iph->saddr, iph->daddr, flags, key, 665 iph->saddr, iph->daddr, flags, key,
670 gre_proto); 666 gre_proto);
@@ -740,14 +736,11 @@ static int ipgre_rcv(struct sk_buff *skb)
740 736
741 netif_rx(skb); 737 netif_rx(skb);
742 738
743 rcu_read_unlock();
744 return 0; 739 return 0;
745 } 740 }
746 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); 741 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
747 742
748drop: 743drop:
749 rcu_read_unlock();
750drop_nolock:
751 kfree_skb(skb); 744 kfree_skb(skb);
752 return 0; 745 return 0;
753} 746}