* [PATCH net 00/12] netrom: Fix all the data-races around sysctls
@ 2024-03-04 8:20 Jason Xing
2024-03-04 8:20 ` [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality Jason Xing
` (13 more replies)
0 siblings, 14 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
As the title said, in this patchset I fix the data-race issues because
the writer and the reader can manipulate the same value concurrently.
Jason Xing (12):
netrom: Fix a data-race around sysctl_netrom_default_path_quality
netrom: Fix a data-race around
sysctl_netrom_obsolescence_count_initialiser
netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
netrom: Fix a data-race around sysctl_netrom_transport_timeout
netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
netrom: Fix a data-race around
sysctl_netrom_transport_acknowledge_delay
netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
netrom: Fix a data-race around
sysctl_netrom_transport_requested_window_size
netrom: Fix a data-race around
sysctl_netrom_transport_no_activity_timeout
netrom: Fix a data-race around sysctl_netrom_routing_control
netrom: Fix a data-race around sysctl_netrom_link_fails_count
netrom: Fix data-races around sysctl_net_busy_read
net/netrom/af_netrom.c | 14 +++++++-------
net/netrom/nr_dev.c | 2 +-
net/netrom/nr_in.c | 6 +++---
net/netrom/nr_out.c | 2 +-
net/netrom/nr_route.c | 8 ++++----
net/netrom/nr_subr.c | 5 +++--
6 files changed, 19 insertions(+), 18 deletions(-)
--
2.37.3
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Jason Xing
` (12 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
We need to protect the reader reading sysctl_netrom_default_path_quality
because the value can be changed concurrently.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
net/netrom/nr_route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index baea3cbd76ca..6f709fdffc11 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -153,7 +153,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
nr_neigh->digipeat = NULL;
nr_neigh->ax25 = NULL;
nr_neigh->dev = dev;
- nr_neigh->quality = sysctl_netrom_default_path_quality;
+ nr_neigh->quality = READ_ONCE(sysctl_netrom_default_path_quality);
nr_neigh->locked = 0;
nr_neigh->count = 0;
nr_neigh->number = nr_neigh_no++;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
2024-03-04 8:20 ` [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Jason Xing
` (11 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/nr_route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 6f709fdffc11..b8ddd8048f35 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -766,7 +766,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
if (ax25 != NULL) {
ret = nr_add_node(nr_src, "", &ax25->dest_addr, ax25->digipeat,
ax25->ax25_dev->dev, 0,
- sysctl_netrom_obsolescence_count_initialiser);
+ READ_ONCE(sysctl_netrom_obsolescence_count_initialiser));
if (ret)
return ret;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
2024-03-04 8:20 ` [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality Jason Xing
2024-03-04 8:20 ` [PATCH net 02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout Jason Xing
` (10 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/nr_dev.c | 2 +-
net/netrom/nr_out.c | 2 +-
net/netrom/nr_subr.c | 5 +++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 3aaac4a22b38..2c34389c3ce6 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -81,7 +81,7 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev,
buff[6] |= AX25_SSSID_SPARE;
buff += AX25_ADDR_LEN;
- *buff++ = sysctl_netrom_network_ttl_initialiser;
+ *buff++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
*buff++ = NR_PROTO_IP;
*buff++ = NR_PROTO_IP;
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c
index 44929657f5b7..5e531394a724 100644
--- a/net/netrom/nr_out.c
+++ b/net/netrom/nr_out.c
@@ -204,7 +204,7 @@ void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
- *dptr++ = sysctl_netrom_network_ttl_initialiser;
+ *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
if (!nr_route_frame(skb, NULL)) {
kfree_skb(skb);
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c
index e2d2af924cff..c3bbd5880850 100644
--- a/net/netrom/nr_subr.c
+++ b/net/netrom/nr_subr.c
@@ -182,7 +182,8 @@ void nr_write_internal(struct sock *sk, int frametype)
*dptr++ = nr->my_id;
*dptr++ = frametype;
*dptr++ = nr->window;
- if (nr->bpqext) *dptr++ = sysctl_netrom_network_ttl_initialiser;
+ if (nr->bpqext)
+ *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
break;
case NR_DISCREQ:
@@ -236,7 +237,7 @@ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags)
dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
- *dptr++ = sysctl_netrom_network_ttl_initialiser;
+ *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
if (mine) {
*dptr++ = 0;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (2 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Jason Xing
` (9 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 0eed00184adf..4d0e0834d527 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -453,7 +453,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
nr_init_timers(sk);
nr->t1 =
- msecs_to_jiffies(sysctl_netrom_transport_timeout);
+ msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_timeout));
nr->t2 =
msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay);
nr->n2 =
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (3 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Jason Xing
` (8 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 4d0e0834d527..312fc745db7f 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -457,7 +457,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
nr->t2 =
msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay);
nr->n2 =
- msecs_to_jiffies(sysctl_netrom_transport_maximum_tries);
+ msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_maximum_tries));
nr->t4 =
msecs_to_jiffies(sysctl_netrom_transport_busy_delay);
nr->idle =
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (4 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Jason Xing
` (7 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 312fc745db7f..8ada0da3c0e0 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -455,7 +455,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
nr->t1 =
msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_timeout));
nr->t2 =
- msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay);
+ msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_acknowledge_delay));
nr->n2 =
msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_maximum_tries));
nr->t4 =
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (5 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Jason Xing
` (6 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 8ada0da3c0e0..10eee02ef99e 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -459,7 +459,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
nr->n2 =
msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_maximum_tries));
nr->t4 =
- msecs_to_jiffies(sysctl_netrom_transport_busy_delay);
+ msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_busy_delay));
nr->idle =
msecs_to_jiffies(sysctl_netrom_transport_no_activity_timeout);
nr->window = sysctl_netrom_transport_requested_window_size;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (6 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Jason Xing
` (5 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 10eee02ef99e..e65418fb9d88 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -462,7 +462,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_busy_delay));
nr->idle =
msecs_to_jiffies(sysctl_netrom_transport_no_activity_timeout);
- nr->window = sysctl_netrom_transport_requested_window_size;
+ nr->window = READ_ONCE(sysctl_netrom_transport_requested_window_size);
nr->bpqext = 1;
nr->state = NR_STATE_0;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (7 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 10/12] netrom: Fix a data-race around sysctl_netrom_routing_control Jason Xing
` (4 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index e65418fb9d88..1671be042ffe 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -461,7 +461,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
nr->t4 =
msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_busy_delay));
nr->idle =
- msecs_to_jiffies(sysctl_netrom_transport_no_activity_timeout);
+ msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_no_activity_timeout));
nr->window = READ_ONCE(sysctl_netrom_transport_requested_window_size);
nr->bpqext = 1;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 10/12] netrom: Fix a data-race around sysctl_netrom_routing_control
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (8 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count Jason Xing
` (3 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/nr_route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index b8ddd8048f35..89e12e6eea2e 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -780,7 +780,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
return ret;
}
- if (!sysctl_netrom_routing_control && ax25 != NULL)
+ if (!READ_ONCE(sysctl_netrom_routing_control) && ax25 != NULL)
return 0;
/* Its Time-To-Live has expired */
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (9 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 10/12] netrom: Fix a data-race around sysctl_netrom_routing_control Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-04 8:20 ` [PATCH net 12/12] netrom: Fix data-races around sysctl_net_busy_read Jason Xing
` (2 subsequent siblings)
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/nr_route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 89e12e6eea2e..70480869ad1c 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -728,7 +728,7 @@ void nr_link_failed(ax25_cb *ax25, int reason)
nr_neigh->ax25 = NULL;
ax25_cb_put(ax25);
- if (++nr_neigh->failed < sysctl_netrom_link_fails_count) {
+ if (++nr_neigh->failed < READ_ONCE(sysctl_netrom_link_fails_count)) {
nr_neigh_put(nr_neigh);
return;
}
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net 12/12] netrom: Fix data-races around sysctl_net_busy_read
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (10 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count Jason Xing
@ 2024-03-04 8:20 ` Jason Xing
2024-03-07 9:36 ` [PATCH net 00/12] netrom: Fix all the data-races around sysctls Paolo Abeni
2024-03-07 10:00 ` patchwork-bot+netdevbpf
13 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-04 8:20 UTC (permalink / raw)
To: ralf, davem, edumazet, kuba, pabeni
Cc: linux-hams, netdev, kerneljasonxing, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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>
---
net/netrom/af_netrom.c | 2 +-
net/netrom/nr_in.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 1671be042ffe..104a80b75477 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -954,7 +954,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 2f084b6f69d7..97944db6b5ac 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -97,7 +97,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;
@@ -128,7 +128,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;
@@ -262,7 +262,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;
--
2.37.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net 00/12] netrom: Fix all the data-races around sysctls
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (11 preceding siblings ...)
2024-03-04 8:20 ` [PATCH net 12/12] netrom: Fix data-races around sysctl_net_busy_read Jason Xing
@ 2024-03-07 9:36 ` Paolo Abeni
2024-03-07 9:43 ` Jason Xing
2024-03-07 10:00 ` patchwork-bot+netdevbpf
13 siblings, 1 reply; 16+ messages in thread
From: Paolo Abeni @ 2024-03-07 9:36 UTC (permalink / raw)
To: Jason Xing, ralf, davem, edumazet, kuba; +Cc: linux-hams, netdev, Jason Xing
Hi,
On Mon, 2024-03-04 at 16:20 +0800, Jason Xing wrote:
> As the title said, in this patchset I fix the data-race issues because
> the writer and the reader can manipulate the same value concurrently.
I hope this is not a one-shot effort. I think there is quite a bit room
for improvement in the x25/netrom land, e.g. starting from selftests,
if you have time and will:)
The patches LGTM, I'm applying them.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net 00/12] netrom: Fix all the data-races around sysctls
2024-03-07 9:36 ` [PATCH net 00/12] netrom: Fix all the data-races around sysctls Paolo Abeni
@ 2024-03-07 9:43 ` Jason Xing
0 siblings, 0 replies; 16+ messages in thread
From: Jason Xing @ 2024-03-07 9:43 UTC (permalink / raw)
To: Paolo Abeni; +Cc: ralf, davem, edumazet, kuba, linux-hams, netdev, Jason Xing
On Thu, Mar 7, 2024 at 5:36 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> Hi,
>
> On Mon, 2024-03-04 at 16:20 +0800, Jason Xing wrote:
> > As the title said, in this patchset I fix the data-race issues because
> > the writer and the reader can manipulate the same value concurrently.
>
> I hope this is not a one-shot effort. I think there is quite a bit room
> for improvement in the x25/netrom land, e.g. starting from selftests,
> if you have time and will:)
Yes, I'm trying to make time to learn it after work, like fixing
issues that syzbot reports, since Ralf seems inactive in recent years.
I hope I can take it...
>
> The patches LGTM, I'm applying them.
Thanks!
>
> Cheers,
>
> Paolo
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net 00/12] netrom: Fix all the data-races around sysctls
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
` (12 preceding siblings ...)
2024-03-07 9:36 ` [PATCH net 00/12] netrom: Fix all the data-races around sysctls Paolo Abeni
@ 2024-03-07 10:00 ` patchwork-bot+netdevbpf
13 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-07 10:00 UTC (permalink / raw)
To: Jason Xing
Cc: ralf, davem, edumazet, kuba, pabeni, linux-hams, netdev, kernelxing
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 4 Mar 2024 16:20:34 +0800 you wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> As the title said, in this patchset I fix the data-race issues because
> the writer and the reader can manipulate the same value concurrently.
>
> Jason Xing (12):
> netrom: Fix a data-race around sysctl_netrom_default_path_quality
> netrom: Fix a data-race around
> sysctl_netrom_obsolescence_count_initialiser
> netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
> netrom: Fix a data-race around sysctl_netrom_transport_timeout
> netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
> netrom: Fix a data-race around
> sysctl_netrom_transport_acknowledge_delay
> netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
> netrom: Fix a data-race around
> sysctl_netrom_transport_requested_window_size
> netrom: Fix a data-race around
> sysctl_netrom_transport_no_activity_timeout
> netrom: Fix a data-race around sysctl_netrom_routing_control
> netrom: Fix a data-race around sysctl_netrom_link_fails_count
> netrom: Fix data-races around sysctl_net_busy_read
>
> [...]
Here is the summary with links:
- [net,01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality
https://git.kernel.org/netdev/net/c/958d6145a6d9
- [net,02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser
https://git.kernel.org/netdev/net/c/cfd9f4a740f7
- [net,03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
https://git.kernel.org/netdev/net/c/119cae5ea3f9
- [net,04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout
https://git.kernel.org/netdev/net/c/60a7a152abd4
- [net,05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
https://git.kernel.org/netdev/net/c/e799299aafed
- [net,06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay
https://git.kernel.org/netdev/net/c/806f462ba902
- [net,07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
https://git.kernel.org/netdev/net/c/43547d869943
- [net,08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size
https://git.kernel.org/netdev/net/c/a2e706841488
- [net,09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout
https://git.kernel.org/netdev/net/c/f99b494b4043
- [net,10/12] netrom: Fix a data-race around sysctl_netrom_routing_control
https://git.kernel.org/netdev/net/c/b5dffcb8f71b
- [net,11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count
https://git.kernel.org/netdev/net/c/bc76645ebdd0
- [net,12/12] netrom: Fix data-races around sysctl_net_busy_read
https://git.kernel.org/netdev/net/c/d380ce70058a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-03-07 10:00 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
2024-03-04 8:20 ` [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality Jason Xing
2024-03-04 8:20 ` [PATCH net 02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Jason Xing
2024-03-04 8:20 ` [PATCH net 03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Jason Xing
2024-03-04 8:20 ` [PATCH net 04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout Jason Xing
2024-03-04 8:20 ` [PATCH net 05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Jason Xing
2024-03-04 8:20 ` [PATCH net 06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Jason Xing
2024-03-04 8:20 ` [PATCH net 07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Jason Xing
2024-03-04 8:20 ` [PATCH net 08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Jason Xing
2024-03-04 8:20 ` [PATCH net 09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Jason Xing
2024-03-04 8:20 ` [PATCH net 10/12] netrom: Fix a data-race around sysctl_netrom_routing_control Jason Xing
2024-03-04 8:20 ` [PATCH net 11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count Jason Xing
2024-03-04 8:20 ` [PATCH net 12/12] netrom: Fix data-races around sysctl_net_busy_read Jason Xing
2024-03-07 9:36 ` [PATCH net 00/12] netrom: Fix all the data-races around sysctls Paolo Abeni
2024-03-07 9:43 ` Jason Xing
2024-03-07 10:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).