On 64bit arches, struct u64_stats_sync is empty and provides no help
against load/store tearing. memcpy() should not be considered atomic
against u64 values. Use u64_stats_copy() instead.

Signed-off-by: David Yang <[email protected]>
---
 net/bridge/br_multicast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index d55a4ab87837..dccae08b4f4c 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -5201,7 +5201,7 @@ void br_multicast_get_stats(const struct net_bridge *br,
 
                do {
                        start = u64_stats_fetch_begin(&cpu_stats->syncp);
-                       memcpy(&temp, &cpu_stats->mstats, sizeof(temp));
+                       u64_stats_copy(&temp, &cpu_stats->mstats, sizeof(temp));
                } while (u64_stats_fetch_retry(&cpu_stats->syncp, start));
 
                mcast_stats_add_dir(tdst.igmp_v1queries, temp.igmp_v1queries);
-- 
2.51.0


Reply via email to