summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJason Xing <kernelxing@tencent.com>2024-03-04 11:20:46 +0300
committerSasha Levin <sashal@kernel.org>2024-03-15 17:48:16 +0300
commitd623fd5298d95b65d27ef5a618ebf39541074856 (patch)
tree2ef85fe736c4592e79f4e954bc0f77d63cff7e32 /net
parent97a4d8b9f67cc7efe9a0c137e12f6d9e40795bf1 (diff)
downloadlinux-d623fd5298d95b65d27ef5a618ebf39541074856.tar.xz
netrom: Fix data-races around sysctl_net_busy_read
[ Upstream commit d380ce70058a4ccddc3e5f5c2063165dc07672c6 ] We need to protect the reader reading the sysctl value because the value can be changed concurrently. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jason Xing <kernelxing@tencent.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/netrom/nr_in.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 3277f9a7ed02..9e48ce56f085 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -957,7 +957,7 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
* G8PZT's Xrouter which is sending packets with command type 7
* as an extension of the protocol.
*/
- if (sysctl_netrom_reset_circuit &&
+ if (READ_ONCE(sysctl_netrom_reset_circuit) &&
(frametype != NR_RESET || flags != 0))
nr_transmit_reset(skb, 1);
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c
index fbfdae452ff9..01ccd00d1c00 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -100,7 +100,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
break;
case NR_RESET:
- if (sysctl_netrom_reset_circuit)
+ if (READ_ONCE(sysctl_netrom_reset_circuit))
nr_disconnect(sk, ECONNRESET);
break;
@@ -131,7 +131,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
break;
case NR_RESET:
- if (sysctl_netrom_reset_circuit)
+ if (READ_ONCE(sysctl_netrom_reset_circuit))
nr_disconnect(sk, ECONNRESET);
break;
@@ -266,7 +266,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
break;
case NR_RESET:
- if (sysctl_netrom_reset_circuit)
+ if (READ_ONCE(sysctl_netrom_reset_circuit))
nr_disconnect(sk, ECONNRESET);
break;