]> Pileus Git - ~andy/linux/commitdiff
ipv4: Remove redundant RCU locking in ip_check_mc().
authorDavid S. Miller <davem@davemloft.net>
Fri, 11 Mar 2011 00:34:38 +0000 (16:34 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Mar 2011 00:37:26 +0000 (16:37 -0800)
All callers are under rcu_read_lock() protection already.

Rename to ip_check_mc_rcu() to make it even more clear.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/igmp.h
net/ipv4/igmp.c
net/ipv4/route.c

index 74cfcff0148b587b18322f81c2375303c0a4d017..82de336b81550af6a64fff632037acec7e145f2a 100644 (file)
@@ -217,7 +217,7 @@ struct ip_mc_list {
 #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
 #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
 
-extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
+extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
 extern int igmp_rcv(struct sk_buff *);
 extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
 extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
index 44ba9068b72f9b9136d8126a9b1b76b4cca1ce66..12b65ccca8e9e6aa18e25f22f336485b087a3e09 100644 (file)
@@ -2333,13 +2333,13 @@ void ip_mc_drop_socket(struct sock *sk)
        rtnl_unlock();
 }
 
-int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto)
+/* called with rcu_read_lock() */
+int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto)
 {
        struct ip_mc_list *im;
        struct ip_sf_list *psf;
        int rv = 0;
 
-       rcu_read_lock();
        for_each_pmc_rcu(in_dev, im) {
                if (im->multiaddr == mc_addr)
                        break;
@@ -2361,7 +2361,6 @@ int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 p
                } else
                        rv = 1; /* unspecified source; tentatively allow */
        }
-       rcu_read_unlock();
        return rv;
 }
 
index ac32d8f3d68f14e822724c22023281f97515cb95..f6730d94e307758499f37888144d88873dc23527 100644 (file)
@@ -2309,8 +2309,8 @@ skip_cache:
                struct in_device *in_dev = __in_dev_get_rcu(dev);
 
                if (in_dev) {
-                       int our = ip_check_mc(in_dev, daddr, saddr,
-                                             ip_hdr(skb)->protocol);
+                       int our = ip_check_mc_rcu(in_dev, daddr, saddr,
+                                                 ip_hdr(skb)->protocol);
                        if (our
 #ifdef CONFIG_IP_MROUTE
                                ||
@@ -2368,8 +2368,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
                fi = NULL;
        } else if (type == RTN_MULTICAST) {
                flags |= RTCF_MULTICAST | RTCF_LOCAL;
-               if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src,
-                                oldflp->proto))
+               if (!ip_check_mc_rcu(in_dev, oldflp->fl4_dst, oldflp->fl4_src,
+                                    oldflp->proto))
                        flags &= ~RTCF_LOCAL;
                /* If multicast route do not exist use
                 * default one, but do not gateway in this case.