summaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-09-12 18:02:01 +0200
committerDavid S. Miller <davem@davemloft.net>2023-09-15 11:33:46 +0200
commit2da23eb07c91241d962f3ff05565065484cd8929 (patch)
tree921417255db7f2389304c5f21aac9c828b58caa8 /include/net/ipv6.h
parentipv6: lockless IPV6_MULTICAST_LOOP implementation (diff)
downloadlinux-2da23eb07c91241d962f3ff05565065484cd8929.tar.xz
linux-2da23eb07c91241d962f3ff05565065484cd8929.zip
ipv6: lockless IPV6_MULTICAST_HOPS implementation
This fixes data-races around np->mcast_hops, and make IPV6_MULTICAST_HOPS lockless. Note that np->mcast_hops is never negative, thus can fit an u8 field instead of s16. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2e8e7e31e02e..8a04a8985336 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -914,7 +914,7 @@ static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
int hlimit;
if (ipv6_addr_is_multicast(&fl6->daddr))
- hlimit = np->mcast_hops;
+ hlimit = READ_ONCE(np->mcast_hops);
else
hlimit = READ_ONCE(np->hop_limit);
if (hlimit < 0)