Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dst: annotate data-races around dst->lastuse

(dst_entry)->lastuse is read and written locklessly,
add corresponding annotations.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250630121934.3399505-4-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
8f2b2282 36229b2c

+7 -4
+2 -2
include/net/dst.h
··· 240 240 241 241 static inline void dst_use_noref(struct dst_entry *dst, unsigned long time) 242 242 { 243 - if (unlikely(time != dst->lastuse)) { 243 + if (unlikely(time != READ_ONCE(dst->lastuse))) { 244 244 dst->__use++; 245 - dst->lastuse = time; 245 + WRITE_ONCE(dst->lastuse, time); 246 246 } 247 247 } 248 248
+3 -1
net/core/rtnetlink.c
··· 1026 1026 .rta_error = error, 1027 1027 .rta_id = id, 1028 1028 }; 1029 + unsigned long delta; 1029 1030 1030 1031 if (dst) { 1031 - ci.rta_lastuse = jiffies_delta_to_clock_t(jiffies - dst->lastuse); 1032 + delta = jiffies - READ_ONCE(dst->lastuse); 1033 + ci.rta_lastuse = jiffies_delta_to_clock_t(delta); 1032 1034 ci.rta_used = dst->__use; 1033 1035 ci.rta_clntref = rcuref_read(&dst->__rcuref); 1034 1036 }
+2 -1
net/ipv6/route.c
··· 2133 2133 * expired, independently from their aging, as per RFC 8201 section 4 2134 2134 */ 2135 2135 if (!(rt->rt6i_flags & RTF_EXPIRES)) { 2136 - if (time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) { 2136 + if (time_after_eq(now, READ_ONCE(rt->dst.lastuse) + 2137 + gc_args->timeout)) { 2137 2138 pr_debug("aging clone %p\n", rt); 2138 2139 rt6_remove_exception(bucket, rt6_ex); 2139 2140 return;