mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 05:56:38 +07:00
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>
This commit is contained in:
parent
69df9d5993
commit
bf8e56bfc4
@ -420,14 +420,16 @@ static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen)
|
|||||||
if (devname[0] == '\0') {
|
if (devname[0] == '\0') {
|
||||||
index = 0;
|
index = 0;
|
||||||
} else {
|
} 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;
|
ret = -ENODEV;
|
||||||
if (!dev)
|
if (!dev)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
index = dev->ifindex;
|
|
||||||
dev_put(dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
|
Loading…
Reference in New Issue
Block a user