Re: [PATCH net v3] ipv6: fix data race in fib6_metric_set() using cmpxchg
From: Jakub Kicinski
Date: Wed Apr 01 2026 - 20:47:42 EST
On Tue, 31 Mar 2026 12:17:18 +0800 Hangbin Liu wrote:
> - if (f6i->fib6_metrics == &dst_default_metrics) {
> + if (READ_ONCE(f6i->fib6_metrics) == &dst_default_metrics) {
> + struct dst_metrics *dflt = (struct dst_metrics *)&dst_default_metrics;
> struct dst_metrics *p = kzalloc_obj(*p, GFP_ATOMIC);
Orthogonal, but I forgot to reply - could you poke at making
cmpxchg() take const on the second argument? The type of the
first and third args must obviously match exactly but the
second one is just a reference, it should be okay to make
it const :/