diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-03 17:35:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-10-03 17:35:55 -0400 |
commit | e5ed639913eea3e4783a550291775ab78dd84966 (patch) | |
tree | e6e915aa686d2a7125181fc83a847e1955a8ba46 /net/ipv4/ipmr.c | |
parent | a5e7c210fefd2454c757a3542e41063407ca7108 (diff) |
[IPV4]: Replace __in_dev_get with __in_dev_get_rcu/rtnl
The following patch renames __in_dev_get() to __in_dev_get_rtnl() and
introduces __in_dev_get_rcu() to cover the second case.
1) RCU with refcnt should use in_dev_get().
2) RCU without refcnt should use __in_dev_get_rcu().
3) All others must hold RTNL and use __in_dev_get_rtnl().
There is one exception in net/ipv4/route.c which is in fact a pre-existing
race condition. I've marked it as such so that we remember to fix it.
This patch is based on suggestions and prior work by Suzanne Wood and
Paul McKenney.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 9dbf5909f3a6..302b7eb507c9 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -149,7 +149,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v) | |||
149 | if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { | 149 | if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { |
150 | dev->flags |= IFF_MULTICAST; | 150 | dev->flags |= IFF_MULTICAST; |
151 | 151 | ||
152 | in_dev = __in_dev_get(dev); | 152 | in_dev = __in_dev_get_rtnl(dev); |
153 | if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) | 153 | if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) |
154 | goto failure; | 154 | goto failure; |
155 | in_dev->cnf.rp_filter = 0; | 155 | in_dev->cnf.rp_filter = 0; |
@@ -278,7 +278,7 @@ static int vif_delete(int vifi) | |||
278 | 278 | ||
279 | dev_set_allmulti(dev, -1); | 279 | dev_set_allmulti(dev, -1); |
280 | 280 | ||
281 | if ((in_dev = __in_dev_get(dev)) != NULL) { | 281 | if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { |
282 | in_dev->cnf.mc_forwarding--; | 282 | in_dev->cnf.mc_forwarding--; |
283 | ip_rt_multicast_event(in_dev); | 283 | ip_rt_multicast_event(in_dev); |
284 | } | 284 | } |
@@ -421,7 +421,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
421 | return -EINVAL; | 421 | return -EINVAL; |
422 | } | 422 | } |
423 | 423 | ||
424 | if ((in_dev = __in_dev_get(dev)) == NULL) | 424 | if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) |
425 | return -EADDRNOTAVAIL; | 425 | return -EADDRNOTAVAIL; |
426 | in_dev->cnf.mc_forwarding++; | 426 | in_dev->cnf.mc_forwarding++; |
427 | dev_set_allmulti(dev, +1); | 427 | dev_set_allmulti(dev, +1); |