Commit 3b15b3e9 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-sysctl-races-round-4'



Kuniyuki Iwashima says:

====================
sysctl: Fix data-races around ipv4_net_table (Round 4).

This series fixes data-races around 17 knobs after fib_multipath_use_neigh
in ipv4_net_table.

tcp_fack was skipped because it's obsolete and there's no readers.

So, round 5 will start with tcp_dsack, 2 rounds left for 27 knobs.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ef562175 a11e5b3e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1236,8 +1236,8 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
	csk->sndbuf = newsk->sk_sndbuf;
	csk->smac_idx = ((struct port_info *)netdev_priv(ndev))->smt_idx;
	RCV_WSCALE(tp) = select_rcv_wscale(tcp_full_space(newsk),
					   sock_net(newsk)->
						ipv4.sysctl_tcp_window_scaling,
					   READ_ONCE(sock_net(newsk)->
						     ipv4.sysctl_tcp_window_scaling),
					   tp->window_clamp);
	neigh_release(n);
	inet_inherit_port(&tcp_hashinfo, lsk, newsk);
@@ -1384,7 +1384,7 @@ static void chtls_pass_accept_request(struct sock *sk,
#endif
	}
	if (req->tcpopt.wsf <= 14 &&
	    sock_net(sk)->ipv4.sysctl_tcp_window_scaling) {
	    READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_window_scaling)) {
		inet_rsk(oreq)->wscale_ok = 1;
		inet_rsk(oreq)->snd_wscale = req->tcpopt.wsf;
	}
+2 −2
Original line number Diff line number Diff line
@@ -10324,7 +10324,7 @@ static void mlxsw_sp_mp4_hash_init(struct mlxsw_sp *mlxsw_sp,
	unsigned long *fields = config->fields;
	u32 hash_fields;

	switch (net->ipv4.sysctl_fib_multipath_hash_policy) {
	switch (READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_policy)) {
	case 0:
		mlxsw_sp_mp4_hash_outer_addr(config);
		break;
@@ -10342,7 +10342,7 @@ static void mlxsw_sp_mp4_hash_init(struct mlxsw_sp *mlxsw_sp,
		mlxsw_sp_mp_hash_inner_l3(config);
		break;
	case 3:
		hash_fields = net->ipv4.sysctl_fib_multipath_hash_fields;
		hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields);
		/* Outer */
		MLXSW_SP_MP_HASH_HEADER_SET(headers, IPV4_EN_NOT_TCP_NOT_UDP);
		MLXSW_SP_MP_HASH_HEADER_SET(headers, IPV4_EN_TCP_UDP);
+1 −1
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ static inline bool sysctl_dev_name_is_allowed(const char *name)

static inline bool inet_port_requires_bind_service(struct net *net, unsigned short port)
{
	return port < net->ipv4.sysctl_ip_prot_sock;
	return port < READ_ONCE(net->ipv4.sysctl_ip_prot_sock);
}

#else
+2 −2
Original line number Diff line number Diff line
@@ -1403,8 +1403,8 @@ static inline void tcp_slow_start_after_idle_check(struct sock *sk)
	struct tcp_sock *tp = tcp_sk(sk);
	s32 delta;

	if (!sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle || tp->packets_out ||
	    ca_ops->cong_control)
	if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle) ||
	    tp->packets_out || ca_ops->cong_control)
		return;
	delta = tcp_jiffies32 - tp->lsndtime;
	if (delta > inet_csk(sk)->icsk_rto)
+1 −1
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ static inline bool udp_sk_bound_dev_eq(struct net *net, int bound_dev_if,
				       int dif, int sdif)
{
#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
	return inet_bound_dev_eq(!!net->ipv4.sysctl_udp_l3mdev_accept,
	return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_udp_l3mdev_accept),
				 bound_dev_if, dif, sdif);
#else
	return inet_bound_dev_eq(true, bound_dev_if, dif, sdif);
Loading