ipv6: annotate data-races around cnf.mtu6
idev->cnf.mtu6 might be read locklessly, add appropriate READ_ONCE() and WRITE_ONCE() annotations. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
553ced03b2
commit
e7135f4849
@ -332,7 +332,7 @@ static inline unsigned int ip6_dst_mtu_maybe_forward(const struct dst_entry *dst
|
||||
rcu_read_lock();
|
||||
idev = __in6_dev_get(dst->dev);
|
||||
if (idev)
|
||||
mtu = idev->cnf.mtu6;
|
||||
mtu = READ_ONCE(idev->cnf.mtu6);
|
||||
rcu_read_unlock();
|
||||
|
||||
out:
|
||||
|
@ -3671,7 +3671,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
|
||||
|
||||
if (idev) {
|
||||
rt6_mtu_change(dev, dev->mtu);
|
||||
idev->cnf.mtu6 = dev->mtu;
|
||||
WRITE_ONCE(idev->cnf.mtu6, dev->mtu);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3763,7 +3763,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
|
||||
if (idev->cnf.mtu6 != dev->mtu &&
|
||||
dev->mtu >= IPV6_MIN_MTU) {
|
||||
rt6_mtu_change(dev, dev->mtu);
|
||||
idev->cnf.mtu6 = dev->mtu;
|
||||
WRITE_ONCE(idev->cnf.mtu6, dev->mtu);
|
||||
}
|
||||
WRITE_ONCE(idev->tstamp, jiffies);
|
||||
inet6_ifinfo_notify(RTM_NEWLINK, idev);
|
||||
|
@ -1578,8 +1578,8 @@ skip_routeinfo:
|
||||
|
||||
if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
|
||||
ND_PRINTK(2, warn, "RA: invalid mtu: %d\n", mtu);
|
||||
} else if (in6_dev->cnf.mtu6 != mtu) {
|
||||
in6_dev->cnf.mtu6 = mtu;
|
||||
} else if (READ_ONCE(in6_dev->cnf.mtu6) != mtu) {
|
||||
WRITE_ONCE(in6_dev->cnf.mtu6, mtu);
|
||||
fib6_metric_set(rt, RTAX_MTU, mtu);
|
||||
rt6_mtu_change(skb->dev, mtu);
|
||||
}
|
||||
|
@ -1596,7 +1596,7 @@ static unsigned int fib6_mtu(const struct fib6_result *res)
|
||||
|
||||
rcu_read_lock();
|
||||
idev = __in6_dev_get(dev);
|
||||
mtu = idev->cnf.mtu6;
|
||||
mtu = READ_ONCE(idev->cnf.mtu6);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
@ -3249,8 +3249,8 @@ u32 ip6_mtu_from_fib6(const struct fib6_result *res,
|
||||
|
||||
mtu = IPV6_MIN_MTU;
|
||||
idev = __in6_dev_get(dev);
|
||||
if (idev && idev->cnf.mtu6 > mtu)
|
||||
mtu = idev->cnf.mtu6;
|
||||
if (idev)
|
||||
mtu = max_t(u32, mtu, READ_ONCE(idev->cnf.mtu6));
|
||||
}
|
||||
|
||||
mtu = min_t(unsigned int, mtu, IP6_MAX_MTU);
|
||||
|
Loading…
Reference in New Issue
Block a user