Commit 7d5424b2 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-sysctl-races'



Kuniyuki Iwashima says:

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

This series fixes data-races around the first 13 knobs and
nexthop_compat_mode in ipv4_net_table.

I will post another patch for three early_demux knobs later,
so the next round will start from ip_default_ttl.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 22b9c41a bdf00bf2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1179,7 +1179,7 @@ ip_autobind_reuse - BOOLEAN
	option should only be set by experts.
	Default: 0

ip_dynaddr - BOOLEAN
ip_dynaddr - INTEGER
	If set non-zero, enables support for dynamic addresses.
	If set to a non-zero value larger than 1, a kernel log
	message will be printed when dynamic address rewriting
+1 −1
Original line number Diff line number Diff line
@@ -1392,7 +1392,7 @@ static void chtls_pass_accept_request(struct sock *sk,
	th_ecn = tcph->ece && tcph->cwr;
	if (th_ecn) {
		ect = !INET_ECN_is_not_ect(ip_dsfield);
		ecn_ok = sock_net(sk)->ipv4.sysctl_tcp_ecn;
		ecn_ok = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn);
		if ((!ect && ecn_ok) || tcp_ca_needs_ecn(sk))
			inet_rsk(oreq)->ecn_ok = 1;
	}
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ static inline bool raw_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_raw_l3mdev_accept,
	return inet_bound_dev_eq(READ_ONCE(net->ipv4.sysctl_raw_l3mdev_accept),
				 bound_dev_if, dif, sdif);
#else
	return inet_bound_dev_eq(true, bound_dev_if, dif, sdif);
+6 −6
Original line number Diff line number Diff line
@@ -1007,13 +1007,13 @@ int proc_dou8vec_minmax(struct ctl_table *table, int write,

	tmp.maxlen = sizeof(val);
	tmp.data = &val;
	val = *data;
	val = READ_ONCE(*data);
	res = do_proc_douintvec(&tmp, write, buffer, lenp, ppos,
				do_proc_douintvec_minmax_conv, &param);
	if (res)
		return res;
	if (write)
		*data = val;
		WRITE_ONCE(*data, val);
	return 0;
}
EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
@@ -1224,9 +1224,9 @@ static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,

		if (jif > INT_MAX)
			return 1;
		*valp = (int)jif;
		WRITE_ONCE(*valp, (int)jif);
	} else {
		int val = *valp;
		int val = READ_ONCE(*valp);
		unsigned long lval;
		if (val < 0) {
			*negp = true;
+2 −2
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ static int inet_sk_reselect_saddr(struct sock *sk)
	if (new_saddr == old_saddr)
		return 0;

	if (sock_net(sk)->ipv4.sysctl_ip_dynaddr > 1) {
	if (READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) > 1) {
		pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n",
			__func__, &old_saddr, &new_saddr);
	}
@@ -1301,7 +1301,7 @@ int inet_sk_rebuild_header(struct sock *sk)
		 * Other protocols have to map its equivalent state to TCP_SYN_SENT.
		 * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme
		 */
		if (!sock_net(sk)->ipv4.sysctl_ip_dynaddr ||
		if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_ip_dynaddr) ||
		    sk->sk_state != TCP_SYN_SENT ||
		    (sk->sk_userlocks & SOCK_BINDADDR_LOCK) ||
		    (err = inet_sk_reselect_saddr(sk)) != 0)
Loading