mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu() and ip6_dst_hoplimit() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f6bc7d9e47
commit
c68f24cc35
1 changed files with 11 additions and 8 deletions
|
@ -1084,11 +1084,11 @@ static int ipv6_get_mtu(struct net_device *dev)
|
||||||
int mtu = IPV6_MIN_MTU;
|
int mtu = IPV6_MIN_MTU;
|
||||||
struct inet6_dev *idev;
|
struct inet6_dev *idev;
|
||||||
|
|
||||||
idev = in6_dev_get(dev);
|
rcu_read_lock();
|
||||||
if (idev) {
|
idev = __in6_dev_get(dev);
|
||||||
|
if (idev)
|
||||||
mtu = idev->cnf.mtu6;
|
mtu = idev->cnf.mtu6;
|
||||||
in6_dev_put(idev);
|
rcu_read_unlock();
|
||||||
}
|
|
||||||
return mtu;
|
return mtu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,12 +1097,15 @@ int ip6_dst_hoplimit(struct dst_entry *dst)
|
||||||
int hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
|
int hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
|
||||||
if (hoplimit < 0) {
|
if (hoplimit < 0) {
|
||||||
struct net_device *dev = dst->dev;
|
struct net_device *dev = dst->dev;
|
||||||
struct inet6_dev *idev = in6_dev_get(dev);
|
struct inet6_dev *idev;
|
||||||
if (idev) {
|
|
||||||
|
rcu_read_lock();
|
||||||
|
idev = __in6_dev_get(dev);
|
||||||
|
if (idev)
|
||||||
hoplimit = idev->cnf.hop_limit;
|
hoplimit = idev->cnf.hop_limit;
|
||||||
in6_dev_put(idev);
|
else
|
||||||
} else
|
|
||||||
hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
|
hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
|
||||||
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
return hoplimit;
|
return hoplimit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue