Thread (13 messages) flat view 13 messages, 5 authors, 2026-01-26
STALE193d

[PATCH net-next v2 6/7] mpls: Fix load tearing with u64_stats

From: David Yang <mmyangfl@gmail.com>
Date: 2026-01-23 16:22:47
Also in: lkml
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

On 64bit arches, struct u64_stats_sync is empty and provides no help
against load/store tearing. struct copying should not be considered
tear-free. Use u64_stats_reads() instead.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 net/mpls/af_mpls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 580aac112dd2..bd2e02b89d09 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1097,7 +1097,7 @@ static void mpls_get_stats(struct mpls_dev *mdev,
 		p = per_cpu_ptr(mdev->stats, i);
 		do {
 			start = u64_stats_fetch_begin(&p->syncp);
-			local = p->stats;
+			u64_stats_reads(&local, &p->stats, sizeof(local));
 		} while (u64_stats_fetch_retry(&p->syncp, start));
 
 		stats->rx_packets	+= local.rx_packets;
-- 
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help