diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-10-18 20:39:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-19 06:50:47 -0400 |
commit | 9e917dca74138cccf398ce8bb924c7fd2980ec1d (patch) | |
tree | 9aeaa145a5a2b4a513a814eb41f05bd2446ddfe5 /net | |
parent | 5d6076bb2e642bbcb1263c6cf239b9a1f3d0df08 (diff) |
net: avoid a dev refcount in ip_mc_find_dev()
We hold RTNL in ip_mc_find_dev(), no need to touch device refcount.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/fib_frontend.c | 2 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3df057e89640..36e27c2107de 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -153,7 +153,7 @@ static void fib_flush(struct net *net) | |||
153 | * @addr: the source address | 153 | * @addr: the source address |
154 | * @devref: if true, take a reference on the found device | 154 | * @devref: if true, take a reference on the found device |
155 | * | 155 | * |
156 | * If a caller uses devref=false, it should be protected by RCU | 156 | * If a caller uses devref=false, it should be protected by RCU, or RTNL |
157 | */ | 157 | */ |
158 | struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) | 158 | struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) |
159 | { | 159 | { |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 25f339672b28..a525328ec372 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1418,6 +1418,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev) | |||
1418 | write_unlock_bh(&in_dev->mc_list_lock); | 1418 | write_unlock_bh(&in_dev->mc_list_lock); |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | /* RTNL is locked */ | ||
1421 | static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) | 1422 | static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) |
1422 | { | 1423 | { |
1423 | struct flowi fl = { .nl_u = { .ip4_u = | 1424 | struct flowi fl = { .nl_u = { .ip4_u = |
@@ -1433,10 +1434,9 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr) | |||
1433 | return idev; | 1434 | return idev; |
1434 | } | 1435 | } |
1435 | if (imr->imr_address.s_addr) { | 1436 | if (imr->imr_address.s_addr) { |
1436 | dev = ip_dev_find(net, imr->imr_address.s_addr); | 1437 | dev = __ip_dev_find(net, imr->imr_address.s_addr, false); |
1437 | if (!dev) | 1438 | if (!dev) |
1438 | return NULL; | 1439 | return NULL; |
1439 | dev_put(dev); | ||
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | if (!dev && !ip_route_output_key(net, &rt, &fl)) { | 1442 | if (!dev && !ip_route_output_key(net, &rt, &fl)) { |