Thread (11 messages) 11 messages, 3 authors, 2026-01-19
STALE191d

[PATCH net-next 3/8] ipv6: annotate date-race in ipv6_can_nonlocal_bind()

From: Eric Dumazet <edumazet@google.com>
Date: 2026-01-15 09:41:50
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

Add a missing READ_ONCE(), and add const qualifiers to the two parameters.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/ipv6.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 7873b34181d9bbf18cc61522967e6db5d646813c..f39cd85e89123a06f7660868ef42c8050d693fbf 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -931,10 +931,10 @@ static inline void iph_to_flow_copy_v6addrs(struct flow_keys *flow,
 
 #if IS_ENABLED(CONFIG_IPV6)
 
-static inline bool ipv6_can_nonlocal_bind(struct net *net,
-					  struct inet_sock *inet)
+static inline bool ipv6_can_nonlocal_bind(const struct net *net,
+					  const struct inet_sock *inet)
 {
-	return net->ipv6.sysctl.ip_nonlocal_bind ||
+	return READ_ONCE(net->ipv6.sysctl.ip_nonlocal_bind) ||
 		test_bit(INET_FLAGS_FREEBIND, &inet->inet_flags) ||
 		test_bit(INET_FLAGS_TRANSPARENT, &inet->inet_flags);
 }
-- 
2.52.0.457.g6b5491de43-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help