Commit 624d5aec authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv6: annotate data-races around devconf->disable_policy

idev->cnf.disable_policy and net->ipv6.devconf_all->disable_policy
can be read locklessly. Add appropriate annotations on reads
and writes.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a8fbd4d9
...@@ -6699,7 +6699,7 @@ int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val) ...@@ -6699,7 +6699,7 @@ int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
if (!rtnl_trylock()) if (!rtnl_trylock())
return restart_syscall(); return restart_syscall();
*valp = val; WRITE_ONCE(*valp, val);
net = (struct net *)ctl->extra2; net = (struct net *)ctl->extra2;
if (valp == &net->ipv6.devconf_dflt->disable_policy) { if (valp == &net->ipv6.devconf_dflt->disable_policy) {
......
...@@ -513,8 +513,8 @@ int ip6_forward(struct sk_buff *skb) ...@@ -513,8 +513,8 @@ int ip6_forward(struct sk_buff *skb)
if (skb_warn_if_lro(skb)) if (skb_warn_if_lro(skb))
goto drop; goto drop;
if (!net->ipv6.devconf_all->disable_policy && if (!READ_ONCE(net->ipv6.devconf_all->disable_policy) &&
(!idev || !idev->cnf.disable_policy) && (!idev || !READ_ONCE(idev->cnf.disable_policy)) &&
!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
goto drop; goto drop;
......
...@@ -4584,8 +4584,8 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net, ...@@ -4584,8 +4584,8 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net,
f6i->dst_nocount = true; f6i->dst_nocount = true;
if (!anycast && if (!anycast &&
(net->ipv6.devconf_all->disable_policy || (READ_ONCE(net->ipv6.devconf_all->disable_policy) ||
idev->cnf.disable_policy)) READ_ONCE(idev->cnf.disable_policy)))
f6i->dst_nopolicy = true; f6i->dst_nopolicy = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment