diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index d5f309875338b662999d3b62dbb9ba9e45265b12..ff37a835a8538b7a73f4c4ceb8e3295ddad06c3f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -379,7 +379,7 @@ static inline bool inet_get_convert_csum(struct sock *sk) static inline bool inet_can_nonlocal_bind(struct net *net, struct inet_sock *inet) { - return net->ipv4.sysctl_ip_nonlocal_bind || + return READ_ONCE(net->ipv4.sysctl_ip_nonlocal_bind) || inet->freebind || inet->transparent; } diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 7207a9769f1a9065e7c6fc09f0ca8c1e4b02fb56..8db8209c5b617fd0ba5d777ff84ec9121ea5fcb0 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -373,7 +373,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) && ret != RTN_LOCAL && !sp->inet.freebind && - !net->ipv4.sysctl_ip_nonlocal_bind) + !READ_ONCE(net->ipv4.sysctl_ip_nonlocal_bind)) return 0; if (ipv6_only_sock(sctp_opt2sk(sp)))