aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-05 21:03:39 -0800
committerDavid S. Miller <davem@davemloft.net>2009-11-05 22:34:24 -0800
commitbf8e56bfc4fcfcef9f08e6233dc619706807893a (patch)
tree9f676974aab7ee5e9eef8f81a62ea9b6408c5ed4 /net/core
parent69df9d5993bd7dd7499ad0e98fe824147fbe5667 (diff)
downloadkernel_samsung_smdk4412-bf8e56bfc4fcfcef9f08e6233dc619706807893a.zip
kernel_samsung_smdk4412-bf8e56bfc4fcfcef9f08e6233dc619706807893a.tar.gz
kernel_samsung_smdk4412-bf8e56bfc4fcfcef9f08e6233dc619706807893a.tar.bz2
net: sock_bindtodevice() RCU-ification
Avoid dev_hold()/dev_put() in sock_bindtodevice() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 5a51512..38820ea 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -420,14 +420,16 @@ static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen)
if (devname[0] == '\0') {
index = 0;
} else {
- struct net_device *dev = dev_get_by_name(net, devname);
+ struct net_device *dev;
+ rcu_read_lock();
+ dev = dev_get_by_name_rcu(net, devname);
+ if (dev)
+ index = dev->ifindex;
+ rcu_read_unlock();
ret = -ENODEV;
if (!dev)
goto out;
-
- index = dev->ifindex;
- dev_put(dev);
}
lock_sock(sk);