aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-01 14:42:09 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-02 02:55:11 -0500
commit3710becf8a58a5c6c4e797e3a3c968c161abdb41 (patch)
tree8206fd7c4508d8eb16f0d00fc1e7437110f938b7 /net
parent685c7944055b9de51ff509719070afae92b3dbe1 (diff)
net: RCU locking for simple ioctl()
All ioctls() implemented by dev_ifsioc_locked() : SIOCGIFFLAGS, SIOCGIFMETRIC, SIOCGIFMTU, SIOCGIFHWADDR, SIOCGIFSLAVE, SIOCGIFMAP, SIOCGIFINDEX & SIOCGIFTXQLEN can use RCU lock instead of dev_base_lock rwlock 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/core/dev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 3c40d545a035..76a1502efe67 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4315,12 +4315,12 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
4315EXPORT_SYMBOL(dev_set_mac_address); 4315EXPORT_SYMBOL(dev_set_mac_address);
4316 4316
4317/* 4317/*
4318 * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock) 4318 * Perform the SIOCxIFxxx calls, inside rcu_read_lock()
4319 */ 4319 */
4320static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd) 4320static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cmd)
4321{ 4321{
4322 int err; 4322 int err;
4323 struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); 4323 struct net_device *dev = dev_get_by_name_rcu(net, ifr->ifr_name);
4324 4324
4325 if (!dev) 4325 if (!dev)
4326 return -ENODEV; 4326 return -ENODEV;
@@ -4552,9 +4552,9 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
4552 case SIOCGIFINDEX: 4552 case SIOCGIFINDEX:
4553 case SIOCGIFTXQLEN: 4553 case SIOCGIFTXQLEN:
4554 dev_load(net, ifr.ifr_name); 4554 dev_load(net, ifr.ifr_name);
4555 read_lock(&dev_base_lock); 4555 rcu_read_lock();
4556 ret = dev_ifsioc_locked(net, &ifr, cmd); 4556 ret = dev_ifsioc_locked(net, &ifr, cmd);
4557 read_unlock(&dev_base_lock); 4557 rcu_read_unlock();
4558 if (!ret) { 4558 if (!ret) {
4559 if (colon) 4559 if (colon)
4560 *colon = ':'; 4560 *colon = ':';