aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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/ipv6
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/ipv6')
-rw-r--r--net/ipv6/ip6_gre.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 424d11a4e7ff..b987d4db790f 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -437,14 +437,12 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
437 ipv6h = (const struct ipv6hdr *)skb->data; 437 ipv6h = (const struct ipv6hdr *)skb->data;
438 p = (__be16 *)(skb->data + offset); 438 p = (__be16 *)(skb->data + offset);
439 439
440 rcu_read_lock();
441
442 t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, 440 t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
443 flags & GRE_KEY ? 441 flags & GRE_KEY ?
444 *(((__be32 *)p) + (grehlen / 4) - 1) : 0, 442 *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
445 p[1]); 443 p[1]);
446 if (t == NULL) 444 if (t == NULL)
447 goto out; 445 return;
448 446
449 switch (type) { 447 switch (type) {
450 __u32 teli; 448 __u32 teli;
@@ -489,8 +487,6 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
489 else 487 else
490 t->err_count = 1; 488 t->err_count = 1;
491 t->err_time = jiffies; 489 t->err_time = jiffies;
492out:
493 rcu_read_unlock();
494} 490}
495 491
496static inline void ip6gre_ecn_decapsulate_ipv4(const struct ip6_tnl *t, 492static inline void ip6gre_ecn_decapsulate_ipv4(const struct ip6_tnl *t,
@@ -528,7 +524,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
528 __be16 gre_proto; 524 __be16 gre_proto;
529 525
530 if (!pskb_may_pull(skb, sizeof(struct in6_addr))) 526 if (!pskb_may_pull(skb, sizeof(struct in6_addr)))
531 goto drop_nolock; 527 goto drop;
532 528
533 ipv6h = ipv6_hdr(skb); 529 ipv6h = ipv6_hdr(skb);
534 h = skb->data; 530 h = skb->data;
@@ -539,7 +535,7 @@ static int ip6gre_rcv(struct sk_buff *skb)
539 - We do not support routing headers. 535 - We do not support routing headers.
540 */ 536 */
541 if (flags&(GRE_VERSION|GRE_ROUTING)) 537 if (flags&(GRE_VERSION|GRE_ROUTING))
542 goto drop_nolock; 538 goto drop;
543 539
544 if (flags&GRE_CSUM) { 540 if (flags&GRE_CSUM) {
545 switch (skb->ip_summed) { 541 switch (skb->ip_summed) {
@@ -567,7 +563,6 @@ static int ip6gre_rcv(struct sk_buff *skb)
567 563
568 gre_proto = *(__be16 *)(h + 2); 564 gre_proto = *(__be16 *)(h + 2);
569 565
570 rcu_read_lock();
571 tunnel = ip6gre_tunnel_lookup(skb->dev, 566 tunnel = ip6gre_tunnel_lookup(skb->dev,
572 &ipv6h->saddr, &ipv6h->daddr, key, 567 &ipv6h->saddr, &ipv6h->daddr, key,
573 gre_proto); 568 gre_proto);
@@ -646,14 +641,11 @@ static int ip6gre_rcv(struct sk_buff *skb)
646 641
647 netif_rx(skb); 642 netif_rx(skb);
648 643
649 rcu_read_unlock();
650 return 0; 644 return 0;
651 } 645 }
652 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0); 646 icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
653 647
654drop: 648drop:
655 rcu_read_unlock();
656drop_nolock:
657 kfree_skb(skb); 649 kfree_skb(skb);
658 return 0; 650 return 0;
659} 651}