Skip to content

Commit 624d5ae

Browse files
edumazetdavem330
authored andcommitted
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: Eric Dumazet <edumazet@google.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a8fbd4d commit 624d5ae

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

net/ipv6/addrconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6699,7 +6699,7 @@ int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
66996699
if (!rtnl_trylock())
67006700
return restart_syscall();
67016701

6702-
*valp = val;
6702+
WRITE_ONCE(*valp, val);
67036703

67046704
net = (struct net *)ctl->extra2;
67056705
if (valp == &net->ipv6.devconf_dflt->disable_policy) {

net/ipv6/ip6_output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ int ip6_forward(struct sk_buff *skb)
513513
if (skb_warn_if_lro(skb))
514514
goto drop;
515515

516-
if (!net->ipv6.devconf_all->disable_policy &&
517-
(!idev || !idev->cnf.disable_policy) &&
516+
if (!READ_ONCE(net->ipv6.devconf_all->disable_policy) &&
517+
(!idev || !READ_ONCE(idev->cnf.disable_policy)) &&
518518
!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
519519
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
520520
goto drop;

net/ipv6/route.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4584,8 +4584,8 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net,
45844584
f6i->dst_nocount = true;
45854585

45864586
if (!anycast &&
4587-
(net->ipv6.devconf_all->disable_policy ||
4588-
idev->cnf.disable_policy))
4587+
(READ_ONCE(net->ipv6.devconf_all->disable_policy) ||
4588+
READ_ONCE(idev->cnf.disable_policy)))
45894589
f6i->dst_nopolicy = true;
45904590
}
45914591

0 commit comments

Comments
 (0)