aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-01 14:23:04 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-02 02:55:09 -0500
commitc148fc2e30c988f7e3ac91738b2c03f1cef44849 (patch)
tree3e9e213cd4dfb554f61cea5315359b1bec330590
parent9fdce099bb72df534daa6193318feaec177998fc (diff)
ipv4: inetdev_by_index() switch to RCU
Use dev_get_by_index_rcu() instead of __dev_get_by_index() and dev_base_lock rwlock Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/devinet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5df2f6a0b0f0..ccccaae50b20 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -405,11 +405,12 @@ struct in_device *inetdev_by_index(struct net *net, int ifindex)
405{ 405{
406 struct net_device *dev; 406 struct net_device *dev;
407 struct in_device *in_dev = NULL; 407 struct in_device *in_dev = NULL;
408 read_lock(&dev_base_lock); 408
409 dev = __dev_get_by_index(net, ifindex); 409 rcu_read_lock();
410 dev = dev_get_by_index_rcu(net, ifindex);
410 if (dev) 411 if (dev)
411 in_dev = in_dev_get(dev); 412 in_dev = in_dev_get(dev);
412 read_unlock(&dev_base_lock); 413 rcu_read_unlock();
413 return in_dev; 414 return in_dev;
414} 415}
415 416