ipv6: lockless IPV6_UNICAST_HOPS implementation

Some np->hop_limit accesses are racy, when socket lock is not held.

Add missing annotations and switch to full lockless implementation.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet
2023-09-12 16:01:59 +00:00
committed by David S. Miller
parent f2fa1c812c
commit b0adfba7ee
6 changed files with 16 additions and 24 deletions
+1 -1
View File
@@ -916,7 +916,7 @@ static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
if (ipv6_addr_is_multicast(&fl6->daddr))
hlimit = np->mcast_hops;
else
hlimit = np->hop_limit;
hlimit = READ_ONCE(np->hop_limit);
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
return hlimit;