diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-10 19:34:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-10 19:37:26 -0500 |
commit | dbdd9a52e38a4a93adfa4d0278801cce4fad98eb (patch) | |
tree | a223ba84f33976b0d2c17d3177cbe976a3c948fc /net/ipv4 | |
parent | 33175d84ee3fa29991adb80513683e010769e807 (diff) |
ipv4: Remove redundant RCU locking in ip_check_mc().
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>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/igmp.c | 5 | ||||
-rw-r--r-- | net/ipv4/route.c | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 44ba9068b72f..12b65ccca8e9 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -2333,13 +2333,13 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2333 | rtnl_unlock(); | 2333 | rtnl_unlock(); |
2334 | } | 2334 | } |
2335 | 2335 | ||
2336 | int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto) | 2336 | /* called with rcu_read_lock() */ |
2337 | int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto) | ||
2337 | { | 2338 | { |
2338 | struct ip_mc_list *im; | 2339 | struct ip_mc_list *im; |
2339 | struct ip_sf_list *psf; | 2340 | struct ip_sf_list *psf; |
2340 | int rv = 0; | 2341 | int rv = 0; |
2341 | 2342 | ||
2342 | rcu_read_lock(); | ||
2343 | for_each_pmc_rcu(in_dev, im) { | 2343 | for_each_pmc_rcu(in_dev, im) { |
2344 | if (im->multiaddr == mc_addr) | 2344 | if (im->multiaddr == mc_addr) |
2345 | break; | 2345 | break; |
@@ -2361,7 +2361,6 @@ int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 p | |||
2361 | } else | 2361 | } else |
2362 | rv = 1; /* unspecified source; tentatively allow */ | 2362 | rv = 1; /* unspecified source; tentatively allow */ |
2363 | } | 2363 | } |
2364 | rcu_read_unlock(); | ||
2365 | return rv; | 2364 | return rv; |
2366 | } | 2365 | } |
2367 | 2366 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ac32d8f3d68f..f6730d94e307 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2309,8 +2309,8 @@ skip_cache: | |||
2309 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 2309 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
2310 | 2310 | ||
2311 | if (in_dev) { | 2311 | if (in_dev) { |
2312 | int our = ip_check_mc(in_dev, daddr, saddr, | 2312 | int our = ip_check_mc_rcu(in_dev, daddr, saddr, |
2313 | ip_hdr(skb)->protocol); | 2313 | ip_hdr(skb)->protocol); |
2314 | if (our | 2314 | if (our |
2315 | #ifdef CONFIG_IP_MROUTE | 2315 | #ifdef CONFIG_IP_MROUTE |
2316 | || | 2316 | || |
@@ -2368,8 +2368,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2368 | fi = NULL; | 2368 | fi = NULL; |
2369 | } else if (type == RTN_MULTICAST) { | 2369 | } else if (type == RTN_MULTICAST) { |
2370 | flags |= RTCF_MULTICAST | RTCF_LOCAL; | 2370 | flags |= RTCF_MULTICAST | RTCF_LOCAL; |
2371 | if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src, | 2371 | if (!ip_check_mc_rcu(in_dev, oldflp->fl4_dst, oldflp->fl4_src, |
2372 | oldflp->proto)) | 2372 | oldflp->proto)) |
2373 | flags &= ~RTCF_LOCAL; | 2373 | flags &= ~RTCF_LOCAL; |
2374 | /* If multicast route do not exist use | 2374 | /* If multicast route do not exist use |
2375 | * default one, but do not gateway in this case. | 2375 | * default one, but do not gateway in this case. |