ipv6: annotate data-races in rt6_probe()
authorEric Dumazet <edumazet@google.com>
Wed, 28 Feb 2024 13:54:33 +0000 (13:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Mar 2024 08:42:32 +0000 (08:42 +0000)
Use READ_ONCE() while reading idev->cnf.rtr_probe_interval
while its value could be changed.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c

index 6a2b53de48182525a923e62ba3fbd13cba60a48a..1b897c57c55fe22eff71a22b51ad25269db622f5 100644 (file)
@@ -645,14 +645,15 @@ static void rt6_probe(struct fib6_nh *fib6_nh)
                write_lock_bh(&neigh->lock);
                if (!(neigh->nud_state & NUD_VALID) &&
                    time_after(jiffies,
-                              neigh->updated + idev->cnf.rtr_probe_interval)) {
+                              neigh->updated +
+                              READ_ONCE(idev->cnf.rtr_probe_interval))) {
                        work = kmalloc(sizeof(*work), GFP_ATOMIC);
                        if (work)
                                __neigh_set_probe_once(neigh);
                }
                write_unlock_bh(&neigh->lock);
        } else if (time_after(jiffies, last_probe +
-                                      idev->cnf.rtr_probe_interval)) {
+                                      READ_ONCE(idev->cnf.rtr_probe_interval))) {
                work = kmalloc(sizeof(*work), GFP_ATOMIC);
        }